fix shudown

This commit is contained in:
jxxghp
2024-10-15 13:42:41 +08:00
parent 810e3c98f9
commit 8af37a0adc
15 changed files with 88 additions and 16 deletions
+3 -3
View File
@@ -9,14 +9,14 @@ def create_app() -> FastAPI:
"""
创建并配置 FastAPI 应用实例。
"""
app = FastAPI(
_app = FastAPI(
title=settings.PROJECT_NAME,
openapi_url=f"{settings.API_V1_STR}/openapi.json",
lifespan=lifespan
)
# 配置 CORS 中间件
app.add_middleware(
_app.add_middleware(
CORSMiddleware,
allow_origins=settings.ALLOWED_HOSTS,
allow_credentials=True,
@@ -24,7 +24,7 @@ def create_app() -> FastAPI:
allow_headers=["*"],
)
return app
return _app
# 创建 FastAPI 应用实例