SGTY 4 日 前
コミット
396bc4a742
1 ファイル変更2 行追加2 行削除
  1. 2 2
      src/knowledge/server.py

+ 2 - 2
src/knowledge/server.py

@@ -75,8 +75,8 @@ async def startup():
     #books_path = Path("E:\\project\\knowledge\\books")
 
     app.mount("/books", StaticFiles(directory=books_path), name="books")
-
-    app.mount("/static", StaticFiles(directory=Path("/Users/ycw/PycharmProjects/knowledge/src/knowledge/static")), name="static")
+    static_dir = Path(__file__).parent / "static"
+    app.mount("/static", StaticFiles(directory=str(static_dir)), name="static")
 
     # 定义一个异步函数,用于返回自定义的Swagger UI HTML页面
     @app.get("/docs", include_in_schema=False)