23 lines
503 B
Python
23 lines
503 B
Python
from fastapi import FastAPI
|
|
|
|
from contextlib import asynccontextmanager
|
|
|
|
from database.database import create_tables, delete_tables
|
|
from routers.uploaded_file_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)
|
|
|