mirror of https://github.com/tiangolo/fastapi.git
📝 Mention in docs that subapps don't fire events (#1554)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
parent
5a3c5f1523
commit
d63475bb7d
|
|
@ -4,6 +4,9 @@ You can define event handlers (functions) that need to be executed before the ap
|
||||||
|
|
||||||
These functions can be declared with `async def` or normal `def`.
|
These functions can be declared with `async def` or normal `def`.
|
||||||
|
|
||||||
|
!!! warning
|
||||||
|
Only event handlers for the main application will be executed, not for [Sub Applications - Mounts](./sub-applications.md){.internal-link target=_blank}.
|
||||||
|
|
||||||
## `startup` event
|
## `startup` event
|
||||||
|
|
||||||
To add a function that should be run before the application starts, declare it with the event `"startup"`:
|
To add a function that should be run before the application starts, declare it with the event `"startup"`:
|
||||||
|
|
@ -41,4 +44,4 @@ Here, the `shutdown` event handler function will write a text line `"Application
|
||||||
So, we declare the event handler function with standard `def` instead of `async def`.
|
So, we declare the event handler function with standard `def` instead of `async def`.
|
||||||
|
|
||||||
!!! info
|
!!! info
|
||||||
You can read more about these event handlers in <a href="https://www.starlette.io/events/" class="external-link" target="_blank">Starlette's Events' docs</a>.
|
You can read more about these event handlers in <a href="https://www.starlette.io/events/" class="external-link" target="_blank">Starlette's Events' docs</a>.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue