Esempio n. 1
0
def run_app():
    from application import app
    import flask_config

    assert flask_config

    app.run(host="0.0.0.0", port=9091)
Esempio n. 2
0
def runserver():
    """This command is meant for development. If no configuration is found,
    we start the app listening from all hosts, from port 9999."""

    # Testig Alembic
    engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI'])
    conn = engine.connect()
    context = MigrationContext.configure(conn)
    current_ver = context.get_current_revision()
    if not current_ver:
        print("Automatic DB Upgrade")
        print("Press Ctrl+C when finished")
        upgrade()
        print("Upgrade completed. Press Ctrl+C and runserver again.")

    try:
        from application import config
        PORT = config.Config.PORT
        DEBUG = config.Config.DEBUG
        HOST = config.Config.HOST
    except ImportError:
        DEBUG = False
        PORT = 9999
        HOST = '0.0.0.0'
    app.run(
        port=PORT,
        debug=DEBUG,
        host=HOST,
        threaded=True)
Esempio n. 3
0
def debug_app():
    from application import app
    import flask_config

    assert flask_config

    app.run(host="0.0.0.0", port=9091, debug=True)
Esempio n. 4
0
def create_server():
    from application import app
    from autoupdate import scheduler
    debugging = app.config['DEBUG']
    run_once = os.environ.get("WERKZEUG_RUN_MAIN") == "true" or not debugging


    def shutdown_server():
        func = request.environ.get('werkzeug.server.shutdown')
        if func is None:
            raise RuntimeError('Not running with the Werkzeug Server')
        func()
    app.shutdown = shutdown_server

    if run_once:
        scheduler.init_app(app)

        import api
        import admin
        import web
        from flask import request

    host = os.getenv('HOST', '0.0.0.0')
    port = int(os.getenv('PORT', '5001'))
    try:
        app.run(host=host, port=port, threaded=True)
    except KeyboardInterrupt, e:
        if debugging:
            shutdown_server()
        raise KeyboardInterrupt(e)
Esempio n. 5
0
def runserver(environment): 
    app = manager.app
    try:
        app = ConfigMiddleware(app, environment)
    except InvalidEnvironmentError as e:
        exit(e.message)    
    app = ControllerMiddleware(app)
    app.run()
Esempio n. 6
0
def main():
  app.run(debug=app.config['DEBUG'])
  optparser = optparse.OptionParser()
  optparser.add_option('--init', dest="init", \
                       action='store_true', default=False)
  options, args = optparser.parse_args()
  if (options.init):
    database.initDB()
Esempio n. 7
0
def runserver(**options):
    # Automatic creation of STORAGE_DIR path if it's missing
    if not os.path.exists(app.config['STORAGE_DIR']):
        os.makedirs(app.config['STORAGE_DIR'])

    app.run(host=app.config['HOST'],
            port=app.config['PORT'],
            debug=app.config['DEBUG'],
            **options)
Esempio n. 8
0
def runserver():
    import os
    os.environ['DEBUG'] = 'true'
    os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = 'true'
    import config
    PORT = config.Deployment.PORT
    HOST = config.Deployment.HOST
    app.run(
        port=PORT,
        host=HOST)
Esempio n. 9
0
def runserver():
    """This command is meant for development. If no configuration is found,
    we start the app listening from all hosts, from port 7777."""
    setup_db()
    setup_register_manager()

    app.run(
        port=app.config['PORT'],
        debug=app.config['DEBUG'],
        host=app.config['HOST'],
        threaded=True)
Esempio n. 10
0
def run(config, host, port, debug, threaded):
    """
    Runs the application on a local development server.
    """
    if config:
        CONFIG.update_etc(config)

    if hasattr(CONFIG, 'set_timezone'):
        CONFIG.set_timezone()

    from application import app
    app.run(host, port, debug=debug, threaded=threaded)
Esempio n. 11
0
def runserver():
    try:
        import config
        PORT = config.Development.PORT
        HOST = config.Development.HOST
        DEBUG = config.Development.DEBUG
    except:
        PORT = 5001
        HOST = '0.0.0.0'
        DEBUG = True
    app.run(port=PORT,
            host=HOST,
            debug=DEBUG)
Esempio n. 12
0
def runserver():
    """This command is meant for development. If no configuration is found,
    we start the app listening from all hosts, from port 8888."""
    try:
        from application import config
        PORT = config.Config.PORT
        DEBUG = config.Config.DEBUG
        HOST = config.Config.HOST
    except ImportError:
        DEBUG = True
        PORT = 8888
        HOST = '0.0.0.0'
    app.run(
        port=PORT,
        debug=DEBUG,
        host=HOST)
Esempio n. 13
0
def runserver():
    """This command is meant for development. If no configuration is found,
    we start the app listening from all hosts, from port 9999.
    """

    setup_db()

    try:
        from application import config
        PORT = config.Config.PORT
        DEBUG = config.Config.DEBUG
        HOST = config.Config.HOST
    except ImportError:
        DEBUG = False
        PORT = 9999
        HOST = '0.0.0.0'
    app.run(
        port=PORT,
        debug=DEBUG,
        host=HOST,
        threaded=True)
Esempio n. 14
0
def runserver():
    try:
        import config
        PORT = config.Development.PORT
        HOST = config.Development.HOST
        DEBUG = config.Development.DEBUG
        app.config['STORAGE_DIR'] = config.Development.STORAGE_DIR
    except ImportError:
        # Default settings
        PORT = 5000
        HOST = '0.0.0.0'
        DEBUG = True
        app.config['STORAGE_DIR'] = '{0}/application/static/storage'.format(
            os.path.dirname(os.path.realpath(__file__)))

    # Automatic creation of STORAGE_DIR path if it's missing
    if not os.path.exists(app.config['STORAGE_DIR']):
        os.makedirs(app.config['STORAGE_DIR'])

    app.run(
        port=PORT,
        host=HOST,
        debug=DEBUG)
Esempio n. 15
0
def run():
    from .db import check_version
    if not check_version():
        print >> sys.stderr, "Database not upgraded!!! Run:"
        print >> sys.stderr, "  alembic upgrade head"
        print >> sys.stderr, "And then run this script again"
        sys.exit(-1)

    parser = optparse.OptionParser(usage =  "Run in development mode the LabManager. In production, please use WSGI.")

    parser.add_option('-p', '--port', dest='port', metavar="PORT",
                        help="Port to be used",
                        type='int', default=5000)

    parser.add_option('--register-fake-rlms', dest='register_fake_rlms', help="Register the fake RLMS", default=False, action='store_true')
    parser.add_option('--testing', dest='testing', help="Enter in testing mode", default=False, action='store_true')
    
    args, _ = parser.parse_args() 
    
    if args.register_fake_rlms:
        from labmanager.tests.unit.fake_rlms import register_fake
        register_fake()

    if args.testing:
        app.config['TESTING'] = True
        app.config['CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config['TRANSLATE_LABMANAGER'] = False

    if app.config['DEBUG']:
        from flask_debugtoolbar import DebugToolbarExtension
        app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
        app.config['DEBUG_TB_PROFILER_ENABLED'] = os.environ.get('DEBUG_TB_PROFILER_ENABLED', 'false').lower() == 'true'
        toolbar = DebugToolbarExtension(app)

    port = int(os.environ.get('PORT', args.port))
    app.run(host='0.0.0.0', port=port, threaded = True)
Esempio n. 16
0
def runserver():
    scheduler.start()
    print 'scheduler started'
    port = int(os.environ.get('PORT', 3000))
    app.run('0.0.0.0', port=port)
Esempio n. 17
0
@app.route('/logout', methods=['GET', 'POST'])
def logout():
    response = app.make_response("Logged out")
    response.set_cookie('username', '', expires = 0)
    return response


#The following routes are to facilitate debugging
@app.route('/debug/populate', methods=['GET', 'POST'])
def populate():
    todo_list = ['Arrive at venue', 'Listen to tutor', 'Do the Tutorial', 'Eat Pizza', 'Work on the project', 'Win']
    db.drop_all()
    db.create_all()
    user = User("Superman")
    for todo in todo_list:
        item = Todo(user, todo)
        for i in range(0, int(round(random()*10))):
            todoTime = TodoTime(item, datetime.now() + timedelta(minutes=round(random()*100)), datetime.now() + timedelta(minutes=round(random()*100)))
            db.session.add(todoTime)
        db.session.add(item)
    db.session.commit()
    return jsonify(length=len(todo_list))


if __name__ == '__main__':
    debug = False
    # comment this out in production (you would (probably) want to have a config facility, in real life)
    debug = True
    app.run(debug=debug)
Esempio n. 18
0
from application import app
if __name__ == '__main__':
	app.run(debug=True,host='0.0.0.0',port='8080')
Esempio n. 19
0
File: app.py Progetto: Jortuk/SFIA-2
from application import app

if __name__ == "__main__":
    app.run(debug=True, host='0.0.0.0', port='5004')
Esempio n. 20
0
from application import app

# Apenas para rodar a aplicação

if __name__ == "__main__":
    app.run(debug=True)
Esempio n. 21
0
from application import app

if __name__ == "__main__":
    app.run(debug=True, port=5000, host="0.0.0.0")
Esempio n. 22
0
#!env/bin/python
# -*- coding: UTF-8 -*-
'''
@author: rafex
'''
from cfg import get
from cfg import getInt
from cfg import getBoolean
import netifaces as ni
from application import app

INTERFACE = get("server", "interface")
PORT = getInt("server", "port")
DEBUG = getBoolean("server", "debug")

ni.ifaddresses(INTERFACE)
IP = ni.ifaddresses(INTERFACE)[2][0]['addr']

if __name__ == '__main__':
    app.run(host=IP, port=PORT, debug=DEBUG)
Esempio n. 23
0
from application import app


if __name__ == '__main__':
    app.run(port=5000, host='0.0.0.0', debug=True)
Esempio n. 24
0
from application import app


if __name__ == '__main__':
    app.run(host='0.0.0.0', port='8080')
Esempio n. 25
0
from flask import Flask
from application import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5006, debug=True)
Esempio n. 26
0
from application import app

app.run(port=8080, debug=True)
Esempio n. 27
0
def run_app():
    create_api()
    app.run(host=APP_HOST, port=APP_PORT)
Esempio n. 28
0
from application import app
from application import CONFIG

if __name__ == "__main__":
    app.run(debug=CONFIG["DEBUG"], port=CONFIG["PORT"])
Esempio n. 29
0
from application import app
# import mysql.connector as mysql

if __name__ == "__main__":
    app.run(ssl_context="adhoc", debug=True)
Esempio n. 30
0
File: run.py Progetto: UWCS/CAS
from application import app
app.run('0.0.0.0', debug=True)
Esempio n. 31
0
#-*-coding:utf8-*-
from application import app
app.run(debug=app.config.get('DEBUG'), host=app.config.get('HOST'), \
       port=app.config.get('PORT'), processes=app.config.get('PROCESSES'))
Esempio n. 32
0
# -*- coding: utf-8 -*-
import os
from application import app, create_db, drop_db

if __name__ == '__main__':
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port)

    #create_db()
    #drop_db()


Esempio n. 33
0
from application import app

if __name__ == '__main__':
    app.run(debug=True, port=5001, host='0.0.0.0')
Esempio n. 34
0
import os
from application import app, db

if __name__ == '__main__':
    # Bind to PORT if defined, otherwise default to 8080.
    port = int(os.environ.get('PORT', 8080))
    app.run(host='0.0.0.0', port=8080)
Esempio n. 35
0
from application import app

if __name__ == "__main__":
    app.run(debug = True, host = "0.0.0.0")
Esempio n. 36
0
from application import app

from flask import render_template, jsonify

from application import operations

@app.route('/')
def main():
	return render_template('main.html')

@app.route('/run/<filename>')
def run(filename):
	result = operations.runRoutes(filename)
	return jsonify({'result': result})

@app.route('/getoutput')
def sendoutput():
	print "eee"
	return app.send_static_file('output.csv')


if __name__ == '__main__':
	app.run()
Esempio n. 37
0
from application import app

if __name__ == '__main__':
    app.run(port=5001, host='0.0.0.0')

#service 2 runing on port 5001
Esempio n. 38
0
__author__ = 'ninad'

from application import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=app.config['PORT'], debug=True)
Esempio n. 39
0
import os
from application import app

PORT = int(os.getenv('PORT', '5000'))

if __name__ == '__main__':
    app.run(debug=True, port=PORT)
    print("Running on port: " + str(PORT))
Esempio n. 40
0
#!flask/bin/python
from application import app
import urllib2
import os

app.run(
		port = 5000,
		host = '0.0.0.0'
	)
Esempio n. 41
0
# Import __init__.py from the application module
from application import app

# Run the application
if __name__ == '__main__':
    app.run(debug=False, host='0.0.0.0', port=5000)
Esempio n. 42
0
from application import app
import admin
import api
import scheduler
import os


if __name__ == '__main__':
    host = os.getenv('HOST', '0.0.0.0')
    port = os.getenv('PORT', 4000)
    scheduler.init_app(app)
    app.run(host=host, port=port, threaded=True)
Esempio n. 43
0
from application import app
from application import CONFIG

if __name__ =="__main__":
	app.run(debug = CONFIG["DEBUG"], port = CONFIG["PORT"])
Esempio n. 44
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#--------------------------------------------------------------
# Application :    Connecthys, le portail internet de Noethys
# Site internet :  www.noethys.com
# Auteur:          Ivan LUCAS
# Copyright:       (c) 2010-16 Ivan LUCAS
# Licence:         Licence GNU GPL
#--------------------------------------------------------------

import imports

# Ajoute au path le chemin des librairies
imports.AjouteCheminLibs()

# Activation du SSL/TLS
#import ssl
#context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
#context.load_cert_chain('path/mon_certificat.crt', 'path/mon_certificat.key')


from application import app
# host='0.0.0.0': écoute sur toutes les interfaces réseaux de la machine (y compris loopback)
# host='192.168.0.1': écoute sur l'interface ayant l'IP 192.168.0.1 uniquement
# host='127.0.0.1': écoute uniquement sur l'interface loopback
# host non défini: écoute uniquement sur l'interface loopback
app.run(host='0.0.0.0', port=5000, debug=True)
Esempio n. 45
0
from application import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8081, debug=True)
Esempio n. 46
0
from application import (app, db, models)
import os


@app.shell_context_processor
def make_shell_context():
    return {'db': db, 'User': models.User, 'Post': models.Post}


# this may not be required as I'm using a top level entry point

# App startup
# if __name__ == '__main__':
#     port = int(os.environ.get('PORT', 5000))

#     app.run(debug=False,
#             host="0.0.0.0",
#             port=port
#             )

port = int(os.environ.get('PORT', 5000))

app.run(debug=False, host="0.0.0.0", port=port)
Esempio n. 47
0
def runserver():
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port)
Esempio n. 48
0
def runserver():
    """This command is meant for development. If no configuration is found,
    we start the app listening from all hosts, from port 7777."""
    # Testig Alembic
    engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI'])
    conn = engine.connect()
    context = MigrationContext.configure(conn)
    current_ver = context.get_current_revision()
    if not current_ver:
        print("Automatic DB Upgrade")
        print("Press Ctrl+C when finished")
        upgrade()
        print("Upgrade completed. Press Ctrl+C and runserver again.")

    try:
        from application import config
        PORT = config.Config.PORT
        DEBUG = config.Config.DEBUG
        HOST = config.Config.HOST
        HOSTNAME = config.Config.HOSTNAME
        VIRTUAL_WORKERS = config.Config.VIRTUAL_WORKERS
    except ImportError:
        DEBUG = False
        PORT = 7777
        HOST = '0.0.0.0'
        VIRTUAL_WORKERS = False
        HOSTNAME = socket.gethostname()

    # TODO: search for the task_compilers and ask for required commands accordigly
    # Render Config
    render_config = JobType.query.filter_by(name='simple_blender_render').first()
    if not render_config:
        configuration = {'commands' : {
            'default' : {
                'Linux' : '',
                'Darwin' : '',
                'Windows' : ''
            }
        }}
        print("Please enter the shared blender path for the simple_blender_render command")
        configuration['commands']['default']['Linux'] = raw_input('Linux path: ')
        configuration['commands']['default']['Darwin'] = raw_input('OSX path: ')
        configuration['commands']['default']['Windows'] = raw_input('Windows path: ')

        render_config = JobType(
            name='simple_blender_render',
            properties=json.dumps(configuration))
        db.session.add(render_config)
        render_config = JobType(
            name='blender_simple_render',
            properties=json.dumps(configuration))
        db.session.add(render_config)
        db.session.commit()
    # Bake config
    bake_config = JobType.query.filter_by(name='blender_bake_anim_cache').first()
    if not bake_config:
        configuration = {'commands' : {
            'default' : {
                'Linux' : '',
                'Darwin' : '',
                'Windows' : ''
            }
        }}
        print("Please enter the shared blender path for the blender_bake_anim_cache command")
        configuration['commands']['default']['Linux'] = raw_input('Linux path: ')
        configuration['commands']['default']['Darwin'] = raw_input('OSX path: ')
        configuration['commands']['default']['Windows'] = raw_input('Windows path: ')

        bake_config = JobType(
            name='blender_bake_anim_cache',
            properties=json.dumps(configuration))
        db.session.add(bake_config)
        db.session.commit()

    # Register the manager to the server
    if os.environ.get('WERKZEUG_RUN_MAIN') != 'true':
        if VIRTUAL_WORKERS:
            has_virtual_worker = 1
        else:
            has_virtual_worker = 0
        full_host = "{0}:{1}".format(HOST, PORT)
        register_manager(full_host, HOSTNAME, has_virtual_worker)

    app.run(
        port=PORT,
        debug=DEBUG,
        host=HOST,
        threaded=True)
Esempio n. 49
0
# Author : CheihChiu
# Date   : 2017-06-06
# Desc   : This module is the main entrance of the program which should be kept in sync
#          with the latest updates of the flask as it evolves.

from application import app

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=5432)
Esempio n. 50
0
from application import app

app.run()

print(app)
Esempio n. 51
0
#!/usr/bin/python

import sys, os, glob
from config import *
path = os.path.join(os.path.dirname(__file__), 'app')
sys.path.insert(0, path)
from application import app, DATA_DIR, OUTPUT_DIR, USER_DIR, TEMP_DIR, training, newUser


if __name__ == '__main__':
    directories = [DIRECTORY, DATA_DIR, OUTPUT_DIR, USER_DIR, PREPROC_DIR, TEMP_DIR]
    for directory in directories:
        if not os.path.exists(directory):
            os.mkdir(directory)
    if not os.path.isfile(os.path.join(DIRECTORY, 'training.json')):
        training()
    if glob.glob(os.path.join(DIRECTORY, 'users', '*.json')) == []:
        newUser(username='******')
    app.run(debug=DEBUG)
Esempio n. 52
0
from application import app

if __name__ == "__main__":
    app.run(debug=True, host='0.0.0.0', port=9000)
Esempio n. 53
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'tclh123'

'''
A WSGI app for dev.
'''

from application import app

if __name__ == "__main__":
    app.debug = True

    app.run(host='0.0.0.0', port=8888)
Esempio n. 54
0
from application import app

# from geventwebsocket.handler import WebSocketHandler
# from gevent.pywsgi import WSGIServer

if __name__ == "__main__":
    # http_server = WSGIServer((OPENSHIFT_INTERNAL_IP, OPENSHIFT_INTERNAL_PORT), app, handler_class=WebSocketHandler)

    app.run(host='localhost', port=8888)
Esempio n. 55
0
__author__ = 'ysekky'

from application import app

app.run(debug=True)
Esempio n. 56
0
from application import app

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5000, debug=True)
Esempio n. 57
0
#!flask/bin/python
from application import app
import urllib2

app.run(
		debug = True, 
		host = urllib2.urlopen("http://myip.dnsdynamic.org/").read(), 
		port = 5000
	)
Esempio n. 58
0
from application import app
from common.libs.Helper import Helper
import www
from gevent.pywsgi import WSGIServer

if __name__ == '__main__':
    if app.config['RUN_ENVIRON'] == 'local':
        app.run(port=80, debug=True, host='127.0.0.1')
    else:
        http_server = WSGIServer(('0.0.0.0', 80), app)
        http_server.serve_forever()
Esempio n. 59
0
if __name__ == '__main__':
	from application import app
	app.run(host='0.0.0.0', port=5000)
Esempio n. 60
0
from application import app
#imports app from __init__.py
if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0')