Skip to content

Commit 82d0a2b

Browse files
committed
简化create_app
1 parent 973b7da commit 82d0a2b

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

fast_tmp/factory.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from fastapi import FastAPI
2-
from starlette.middleware.cors import CORSMiddleware
32

43
from fast_tmp.admin.server import admin
54
from fast_tmp.conf import settings
@@ -11,18 +10,6 @@ def create_app() -> FastAPI:
1110
:return: FastAPI
1211
"""
1312
app = FastAPI(debug=settings.DEBUG)
14-
# 注册app的位置
15-
if settings.BACKEND_CORS_ORIGINS:
16-
app.add_middleware(
17-
CORSMiddleware,
18-
allow_origins=[str(origin) for origin in settings.BACKEND_CORS_ORIGINS],
19-
allow_credentials=True,
20-
allow_methods=["*"],
21-
allow_headers=["*"],
22-
)
23-
# 在cookie存储session
24-
# app.add_middleware(SessionMiddleware, secret_key=settings.CAS_SESSION_SECRET)
25-
2613
app.mount("/admin", admin, name="admin")
2714

2815
return app

0 commit comments

Comments
 (0)