async def on_startup(): loop = get_ioloop() if config.EMAIL_ENABLE: asyncio.ensure_future(mail.init(loop), loop=loop) await redis_init(loop) if config.UPLOAD_ENABLE: qn.init()
async def on_startup(): loop = get_ioloop() if config.EMAIL_ENABLE: asyncio.ensure_future(mail.init(loop), loop=loop) await redis_init(loop) if config.UPLOAD_ENABLE: if config.UPLOAD_BACKEND == 'qiniu': from lib import qn qn.init()
import asyncio from app import app from lib import mail, upload import config if __name__ == '__main__': import model._models import view._views if config.EMAIL_ENABLE: loop = asyncio.get_event_loop() asyncio.ensure_future(mail.init(loop), loop=loop) if config.UPLOAD_ENABLE: upload.init() app.run(host=config.HOST, port=config.PORT)