import asyncio from contextlib import asynccontextmanager from fastapi import FastAPI from app import api_router from utils.scripts import startup, shutdown @asynccontextmanager async def lifespan(app: FastAPI): await startup() yield await shutdown() app = FastAPI(lifespan=lifespan) app.include_router(router=api_router)