예제 #1
0
def console_app():
    loop = get_loop()
    conf = loop.run_until_complete(config.load_config(loop=loop))
    db_pool = loop.run_until_complete(
        db.create_pool(loop=loop, conf=conf['postgres']))
    console_app = start_console_app(conf, db_pool, loop)
    return console_app
예제 #2
0
def web_app():
    loop = get_loop()
    conf = loop.run_until_complete(config.load_config(loop=loop))
    db_pool = loop.run_until_complete(
        db.create_pool(
            conf=conf['postgres'],
            loop=loop,
        ))
    web_app = start_web_app(conf, db_pool, loop)
    web.run_app(web_app, host=conf['host'], port=conf['port'])
예제 #3
0
def web_app():
    loop = get_loop()
    conf = loop.run_until_complete(config.load_config(loop=loop))
    db_pool = loop.run_until_complete(
        db.create_pool(
            conf=conf['postgres'],
            loop=loop,
        ))

    if 'migrate' in sys.argv:
        file_to_path = sys.argv.pop()
        loop.run_until_complete(migration_sql(db_pool, conf, file_to_path))
        return

    app = start_web_app(conf, db_pool, loop)
    web.run_app(app, **conf['web_run'])