is it not mistake create some connections (to DB, AMQP etc) before run web.run_app
in aiohttp.
Some example:
async def init_app():
app = web.Application()
app['db'] = await create_db_connection()
app['amqp'] = await create_amqp_connection()
return app
if __name__ == '__main__':
app = asyncio.get_event_loop().run_until_complete(init_app())
web.run_app(app)
It works, but I'm not sure about is this right or not.
I know about app.startup
but I have I'd like to handle all connection's errors before start main application.