from fastapi import FastAPI from fastapi.staticfiles import StaticFiles from fastapi.responses import HTMLResponse from fastapi import Request from fastapi.templating import Jinja2Templates import uvicorn templates = Jinja2Templates(directory="templates") app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") @app.get("/", response_class=HTMLResponse) async def home(request: Request, ): index_data = {"foo": "bar"} return templates.TemplateResponse( "general_pages/index.html", {"request": request, "models": index_data} ) if __name__ == "__main__": uvicorn.run(app='main:app', port=3000, reload=True)