diff --git a/src/backend/main.py b/src/backend/main.py index 139ad5c..b12cac0 100644 --- a/src/backend/main.py +++ b/src/backend/main.py @@ -25,12 +25,13 @@ @app.middleware("http") -async def add_static_filter(request: Request, call_next): +async def static_filter(request: Request, call_next): urlpath = request.url.path # 如果是 fastapi 相关的路由,直接返回 if ( urlpath.startswith("/api") or urlpath.startswith("/docs") + or urlpath.startswith("/redoc") or urlpath == "/openapi.json" ): return await call_next(request) diff --git a/src/backend/routers.py b/src/backend/routers.py index 071141e..7c6bdb4 100644 --- a/src/backend/routers.py +++ b/src/backend/routers.py @@ -26,6 +26,7 @@ def wrapper(*args, **kwargs): # FastAPI Dependency def get_session(): + # 获得一个 session session = db.ScopedSession() try: yield session