/
KohNikita
/
FastAPI_pet_project
Обзор
Документация
Войти
/
KohNikita
/
FastAPI_pet_project
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
main.py
20 строк
480 B
aladushek11
first_commit
18 окт 2024, 17:39
18 окт 2024, 17:39
62bba06
Код
Авторство
О чём код?
from fastapi import FastAPI, Depends from contextlib import asynccontextmanager from database import create_tables, delete_tables from router import router as task_router @asynccontextmanager async def lifespan(app: FastAPI): await delete_tables() print("База отчишена") await create_tables() print("База готова к работе") yield print("Включение") app = FastAPI(lifespan=lifespan) app.include_router(task_router)