INNER CODE UNIT · Python

create_app

Xeron2000/openOii · backend/app/main.py:48

def create_app() -> FastAPI:
    settings = get_settings()
    app = FastAPI(title=settings.app_name, lifespan=lifespan)

    app.add_middleware(
        CORSMiddleware,
        allow_origins=settings.cors_origins,
        allow_origin_regex=_local_dev_origin_regex(settings.environment),
        allow_credentials=True,
        allow_methods=["*"],
        allow_headers=["*"],
    )

    app.include_router(api_router, prefix=settings.api_v1_prefix)

    # 挂载静态文件服务(用于提供拼接后的视频)
    app.mount("/static", StaticFiles(directory=str(STATIC_DIR)), name="static")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…