Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[BUG][DOCUMENTATION] Sub application startup event never triggered #811
Comments
|
Digging in to this a bit more, I can see that FastAPI merely exposes the Starlette lifecycle events and doesn't do anything special about them. In addition, this issue has been raised previously against Starlette. Since it's deemed out-of-scope by Starlette developers, I think the only action here would be to document this in the FastAPI docs i.e. call out explicitly that sub-application event handlers are ignored. |
|
I also think it would be good to document this. PR welcome! |
|
Thanks for the investigation and for reporting back @jonathanunderwood , yep, it makes sense to have it documented. |
|
I found this issue this days, so what should I do to trigger subapp's start_up callbacks? |
Describe the bug
Startup event handlers for sub-applications never trigger.
To Reproduce
Running the above shows:
$ python subapp_events.py INFO: Started server process [38462] INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit) INFO: Waiting for application startup. ++++ App startup event INFO: Application startup complete.Notice that
sub_app_startup()is never run.Expected behavior
I would expect the sub-application startup event handler to also run (although I am not sure what ordering I would expect).
Environment
Additional context
N/A