def run_server(config_file): loop = uvloop.new_event_loop() asyncio.set_event_loop(loop) srv, handler = loop.run_until_complete(init_app(loop, config_file.name)) try: loop.run_forever() except KeyboardInterrupt: loop.run_until_complete(handler.finish_connections())
def runserver(): """Run application server""" loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) srv, handler = loop.run_until_complete(init_app(loop=loop)) try: loop.run_forever() except KeyboardInterrupt: loop.run_until_complete(handler.finish_connections())
def _build_app(cls): app = init_app( import_name=__name__, config_module=Config ) # Establish an application context before running the tests. ctx = app.app_context() ctx.push() return app
import logging import schedule import time from app.app import init_app def health_check(): logging.info('Health check pass') def default_run(): logging.debug('Default run start...') schedule.every(1).minute.do(health_check) logging.info('Default run done.') def loop(): logging.debug('Start loop') while True: schedule.run_pending() time.sleep(60) if __name__ == '__main__': init_app() default_run() loop()
def main(): app = init_app() web.run_app(app, host='0.0.0.0', port='8080')
def secured_app(request): conf = TestConfig.copy() conf['ISSUER_SECRET_KEY'] = 'TEST_KEY' app = init_app(conf) return app
def app(request): app = init_app(TestConfig) return app
from bottle import run from app.app import init_app app = application = init_app() if __name__ == '__main__': run(app, debug=True, reloader=True, port=1000)
from app.app import init_app from app.base import manager from manager.worker import init_worker app = init_app() celery = init_worker() if __name__ == '__main__': manager.run()