示例#1
0
def start_instance(settings):
    http_server = tornado.httpserver.HTTPServer(app.setup_app(settings))
    http_server.listen(settings['port'])

    try:
        tornado.ioloop.IOLoop.instance().start()
    except KeyboardInterrupt:
        pass
示例#2
0
def start_instance(settings):
    http_server = tornado.httpserver.HTTPServer(
        app.setup_app(settings)
        )
    http_server.listen(settings['port'])

    try: tornado.ioloop.IOLoop.instance().start()
    except KeyboardInterrupt: pass
示例#3
0
#!/usr/bin/python2
# -*- coding: utf-8 -*-

r"""
Main entry point for app engine instance.
"""

from app import (
    alusta,
    setup_app,
    setup_appengine,
)

app = alusta()

setup_appengine(app)
setup_app(app)

if app.config.get("DEBUG"):
    import time
    from flask import g

    @app.before_request
    def before_request():
        g.start_time = time.time()

    @app.teardown_request
    def teardown_request(exception=None):
        diff = time.time() - g.start_time
        app.logger.info("Page generation took %f seconds.", diff)
示例#4
0
#!/usr/bin/env python
# -*- coding:utf-8 *-*
import os

from app import setup_app
app = setup_app()
示例#5
0
#!/usr/bin/env python
import os
from app import create_app, setup_app
from flask import request, g, render_template
from flask.ext.script import Manager, Shell
from app.structures.LocationsKDTree import LocationsKDTree
from app.structures.InvertedPointLocationIndex import InvertedPointLocationIndex

env_configuration = os.getenv('FLASK_CONFIG') if os.getenv('FLASK_CONFIG') else 'default'
print os.getenv('FLASK_CONFIG')

#   Create Flask Application
app = create_app(env_configuration)

print "Running the " + env_configuration + " configuration ..."
setup_app(env_configuration)
print "Finished running the " + env_configuration + " configuration ..."

#   Manager to manage large-scale Flask apps
manager = Manager(app)

#   An inverted index, mapping UTM (Universal Transverse Mercator) lat/lng
#   values geolocating each film, to a LIST of films that were filmed
#   at that location.
#
#   IMPORTANT!:  This is a shared data-structure, built only at startup,
#   that is READ-ONLY by all, and so can be safely shared.
invertedPointLocationIndex = InvertedPointLocationIndex()
invertedPointLocationIndex.build_inverted_location_index()

#   A KD tree, implemented using the scipy package's kdtree implementation
示例#6
0
from app import app, setup_app

application = app
setup_app()
示例#7
0
from app import setup_app

application = setup_app()
示例#8
0
# -*- coding: utf-8 -*-

from app import setup_app

application = setup_app()
示例#9
0
                        dest="mode",
                        const="test",
                        help="Test mode.")
    parser.add_argument("-P",
                        "--production",
                        action="store_true",
                        help="Production mode.")
    parser.add_argument("-s",
                        "--shell",
                        action="store_const",
                        dest="mode",
                        const="shell",
                        help="Interactive mode.")
    parser.add_argument("-r",
                        "--reset",
                        action="store_true",
                        help="Reset database.")
    # Parse arguments
    args = vars(parser.parse_args())
    if not args.get("mode"):
        args["mode"] = "app"
    app.run_with_mode(**args)
# Production mode; get WSGI application
else:
    # Set-up application
    app.setup_app(db_uri=app.DB_URI)
    # Create database
    app.db.create_all()
    # WSGI application
    application = app.app
示例#10
0
import os
import sys
import pecan

from wsgiref.simple_server import make_server

ROOT_PATH = os.path.dirname(
    os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

if ROOT_PATH not in sys.path:
    sys.path.append(ROOT_PATH)

conf = pecan.configuration.conf_from_file('/pact/httpservice/config.py')
import app as app_mod
app = app_mod.setup_app(conf)

host, port = conf.server.host, int(conf.server.port)
srv = make_server(host, port, app)

print('Starting server in PID %s' % os.getpid())

if host == '0.0.0.0':
    print('serving on 0.0.0.0:%s, view at http://127.0.0.1:%s' % (port, port))
else:
    print("serving on http://%s:%s" % (host, port))

try:
    srv.serve_forever()
except KeyboardInterrupt:
    # allow CTRL+C to shutdown
    pass
示例#11
0
from app import setup_app
setup_app()
from app import setup_app

app = setup_app()
if __name__ == "__main__":
    """Run the application"""
    app.run(host=app.config.get("HOST"), port=app.config.get("PORT"))
示例#13
0
 def config_app(config=None, env=None):
     return setup_app(config, env)
示例#14
0
#!/usr/bin/python2
# -*- coding: utf-8 -*-

r"""
Admin interface entry point for app engine instances
"""

from app import (
    setup_app,
    setup_appengine,
    alusta,
)
from tiea2080 import admin

admin_app = alusta()

setup_appengine(admin_app)

# Inject our own stuff.
admin.init_app(admin_app)

# Main setup
setup_app(admin_app)
示例#15
0
 def create_app(self):
     app = setup_app()
     app.config['TESTING'] = True
     return app
示例#16
0
def on_starting(server):
    app.setup_app(app.app)