/
Matvey_7727
/
Fast_API.pet_project
Обзор
Документация
Войти
/
Matvey_7727
/
Fast_API.pet_project
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
main.py
21 строка
475 B
Matvey_7727
first_commit
18 окт 2024, 18:12
18 окт 2024, 18:12
db25bef
Код
Авторство
О чём код?
from fastapi import FastAPI from contextlib import asynccontextmanager from database import create_tables, delete_tables from router import router as tasks_router @asynccontextmanager async def lifespan(app: FastAPI): await delete_tables() print("База очищена") await create_tables() print("База готова к работе") yield print("Выключение") app = FastAPI(lifespan=lifespan) app.include_router(tasks_router)