Template
mirror of
https://github.com/Nekidev/uv-fastapi-tortoise.git
synced 2026-09-12 19:57:25 +00:00
15 lines
233 B
Python
15 lines
233 B
Python
from fastapi import FastAPI
|
|
|
|
from contextlib import asynccontextmanager
|
|
|
|
from project.db import lifespan as db
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
await db.on_startup()
|
|
|
|
yield
|
|
|
|
await db.on_shutdown()
|