INNER CODE UNIT · Python
lifespan
JiayuXu0/FastAPI-Template · src/__init__.py:60
async def lifespan(app: FastAPI):
await cache_manager.connect()
await init_arq_pool()
await init_data()
try:
yield
finally:
await close_arq_pool()
await cache_manager.disconnect()
await Tortoise.close_connections()
def create_app() -> FastAPI:
app = FastAPI(
title=settings.APP_TITLE,
description=settings.APP_DESCRIPTION,
version=settings.VERSION,
docs_url=None,