/
zaler
/
FastAPI_pet_project
Обзор
Документация
Войти
/
zaler
/
FastAPI_pet_project
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
main.py
21 строка
435 B
egor chikalin
first_commit
18 окт 2024, 17:46
18 окт 2024, 17:46
c7fd6ca
Код
Авторство
О чём код?
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("Base was cleaned") await create_tables() print("Base is ready to work") yield print("Off") app = FastAPI(lifespan=lifespan) app.include_router(tasks_router)