Вот простое статическое приложение FastAPI. При такой настройке, хотя ожидается, что корневой путь вернет FileResponse custom.html, приложение все равно возвращает index.html. Как мне заставить корневой путь работать и отображать custom.html?
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from fastapi.responses import FileResponse
app = FastAPI()
app.mount(
"/",
StaticFiles(directory="static", html=True),
name="static",
)
@app.get("/")
async def index() -> FileResponse:
return FileResponse("custom.html", media_type="html")
Подробнее здесь: https://stackoverflow.com/questions/731 ... e-using-st
Мобильная версия