Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/fastapi/fastapi
/ shutdown_event
Function
shutdown_event
docs_src/events/tutorial002_py310.py:7–9 ·
view source on GitHub ↗
()
Source
from the content-addressed store, hash-verified
5
6
@app.on_event(
"shutdown"
)
7
def
shutdown_event():
8
with
open(
"log.txt"
, mode=
"a"
)
as
log:
9
log.write(
"Application shutdown"
)
10
11
12
@app.get(
"/items/"
)
Callers
nothing calls this directly
Calls
1
write
Method · 0.80
Tested by
no test coverage detected