WEB UI
This commit is contained in:
10
main.py
10
main.py
@@ -50,7 +50,15 @@ app.include_router(control.router, prefix="/control", tags=["Control"])
|
||||
app.include_router(schedules.router, prefix="/schedules", tags=["Schedules"])
|
||||
|
||||
# Статика
|
||||
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
||||
# Мы убираем html=True из корня, чтобы 404-е ошибки API не превращались в загрузку index.html
|
||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def read_index():
|
||||
from fastapi.responses import FileResponse
|
||||
|
||||
return FileResponse("static/index.html")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user