INNER CODE UNIT · Python

lifespan

AtticusZeller/fastapi_supabase_template · backend/app/main.py:19

async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:  # noqa ARG001
    """life span events"""
    try:
        logger.info("lifespan start")
        yield
    finally:
        logger.info("lifespan exit")


# init FastAPI with lifespan
app = FastAPI(
    lifespan=lifespan,
    title=settings.PROJECT_NAME,
    openapi_url=f"{settings.API_V1_STR}/openapi.json",
    generate_unique_id_function=custom_generate_unique_id,
)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…