uvicorn run

This commit is contained in:
Dmitry Afanasyev 2022-08-08 13:52:26 +03:00
parent 880a79a7ad
commit 11f94dff81

24
main.py
View File

@ -45,14 +45,14 @@ async def on_shutdown(dp):
logger.warning('Bye!') logger.warning('Bye!')
# async def async_app(): async def async_app():
# app = make_app() app = get_new_configured_app(dispatcher=dp, path=WEBHOOK_PATH)
# executor = Executor(dp, skip_updates=True) executor = Executor(dp, skip_updates=True)
# executor.on_startup(on_startup) executor.on_startup(on_startup)
# executor.on_shutdown(on_shutdown) executor.on_shutdown(on_shutdown)
# executor._prepare_webhook(config.WEBHOOK_PATH, app=app) executor._prepare_webhook(WEBHOOK_PATH, app=app)
# await executor._startup_webhook() await executor._startup_webhook()
# return app return app
if __name__ == '__main__': if __name__ == '__main__':
@ -60,13 +60,7 @@ if __name__ == '__main__':
download_gecko_driver() download_gecko_driver()
driver = configure_firefox_driver() driver = configure_firefox_driver()
app = get_new_configured_app(dispatcher=dp, path=WEBHOOK_PATH) uvicorn.run(async_app(), host=WEBAPP_HOST, port=WEBAPP_PORT)
# Setup event handlers.
app.on_startup.append(on_startup)
app.on_shutdown.append(on_shutdown)
app.skip_updates = True
uvicorn.run(app, host=WEBAPP_HOST, port=WEBAPP_PORT)
# start_webhook( # start_webhook(
# dispatcher=dp, # dispatcher=dp,