I have tried :
app.mount("", StaticFiles(directory="index.html", html = True), name="index.html")
as well as :
templates = Jinja2Templates(directory="/")
app.mount("/", StaticFiles(directory="/"))
@app.get("/")
def serve_home(request: Request):
return templates.TemplateResponse("index.html", context= {"request": request})
In both cases I could not import static files using :
from fastapi.staticfiles import StaticFiles
It seems from fastapi import FastAPI
also could not be resolved but that did not stop the program from working before I tried loading the html file,