|
@@ -75,8 +75,8 @@ async def startup():
|
|
#books_path = Path("E:\\project\\knowledge\\books")
|
|
#books_path = Path("E:\\project\\knowledge\\books")
|
|
|
|
|
|
app.mount("/books", StaticFiles(directory=books_path), name="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页面
|
|
# 定义一个异步函数,用于返回自定义的Swagger UI HTML页面
|
|
@app.get("/docs", include_in_schema=False)
|
|
@app.get("/docs", include_in_schema=False)
|