23 lines
493 B
Python

from fastapi import FastAPI
from contextlib import asynccontextmanager
from database.database import create_tables, delete_tables
from routers.csv_router import router as csv_router
@asynccontextmanager
async def lifespan(app: FastAPI):
await delete_tables()
print("База очищена")
await create_tables()
print("База готова к работе")
yield
print("Выключение")
app = FastAPI(lifespan=lifespan)
app.include_router(csv_router)