formatting
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# FastAPI Best Practices
|
||||
|
||||
Source: https://fastapi.tiangolo.com/deployment/ | https://fastapi.tiangolo.com/advanced/events/
|
||||
!!! info "Primary sources"
|
||||
- [FastAPI deployment](https://fastapi.tiangolo.com/deployment/)
|
||||
- [FastAPI lifespan events](https://fastapi.tiangolo.com/advanced/events/)
|
||||
|
||||
---
|
||||
|
||||
@@ -44,7 +46,8 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
||||
app = create_app()
|
||||
```
|
||||
|
||||
**Never use `@app.on_event("startup")` / `@app.on_event("shutdown")`** — these are deprecated. The `asynccontextmanager` lifespan is the canonical approach since FastAPI 0.95.
|
||||
!!! warning "Prefer lifespan handlers"
|
||||
Never use `@app.on_event("startup")` / `@app.on_event("shutdown")`. These are deprecated. The `asynccontextmanager` lifespan is the canonical approach since FastAPI 0.95.
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user