From: Andrew Date: Sun, 14 Jun 2020 16:25:10 +0000 (-0400) Subject: 📝 Mention in docs that subapps don't fire events (#1554) X-Git-Tag: 0.58.0~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d63475bb7dd0d5d74dc3d67f037fc095ca1d197b;p=thirdparty%2Ffastapi%2Ffastapi.git 📝 Mention in docs that subapps don't fire events (#1554) Co-authored-by: Sebastián Ramírez --- diff --git a/docs/en/docs/advanced/events.md b/docs/en/docs/advanced/events.md index 8b3dc7af18..7cd2998f05 100644 --- a/docs/en/docs/advanced/events.md +++ b/docs/en/docs/advanced/events.md @@ -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`. +!!! 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 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`. !!! info - You can read more about these event handlers in Starlette's Events' docs. \ No newline at end of file + You can read more about these event handlers in Starlette's Events' docs.