fix:main.py

This commit is contained in:
吕新雨
2026-02-03 01:44:25 +08:00
parent 17d19f9172
commit 991e72d3c0

View File

@@ -9,7 +9,7 @@ def create_app() -> FastAPI:
""" """
创建 FastAPI 应用实例。 创建 FastAPI 应用实例。
说明:目前仅提供最小可运行骨架(health check),后续逐步加入路由与中间件。 说明:目前仅提供最小可运行骨架(健康检查),后续逐步加入路由与中间件。
""" """
settings = get_settings() settings = get_settings()
@@ -20,6 +20,13 @@ def create_app() -> FastAPI:
app.include_router(user_profile_router) app.include_router(user_profile_router)
app.include_router(reco_router) app.include_router(reco_router)
@app.get("/health")
async def health() -> dict:
"""
部署健康检查(兼容常见探针路径)。
"""
return {"status": "ok", "env": settings.app_env}
@app.get("/healthz") @app.get("/healthz")
async def healthz() -> dict: async def healthz() -> dict:
return {"status": "ok", "env": settings.app_env} return {"status": "ok", "env": settings.app_env}