cleanup and fix runtime bugs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""FastAPI app."""
|
||||
# Создание FastAPI-приложения и настройка его жизненного цикла.
|
||||
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
@@ -11,7 +11,7 @@ from .routes import cars, health, tasks
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
"""Жизненный цикл."""
|
||||
# Жизненный цикл.
|
||||
persistence: PersistenceService = app.state.persistence
|
||||
persistence.create_tables()
|
||||
yield
|
||||
@@ -37,5 +37,5 @@ def create_app(settings: Settings | None = None) -> FastAPI:
|
||||
return app
|
||||
|
||||
|
||||
# Для запуска через uvicorn.
|
||||
# Экземпляр приложения для запуска через uvicorn.
|
||||
app = create_app()
|
||||
|
||||
Reference in New Issue
Block a user