from fastapi.templating import Jinja2Templates from fastapi.staticfiles import StaticFiles templates = Jinja2Templates(directory="templates") app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") @app.get("/devices") async def ruckus(request: Request, db: Session = Depends(get_db)): .... devices = db.query(models.Ruckus).order_by(models.Ruckus.id.desc()) return templates.TemplateResponse("index.html", {"request": request, "devices": devices})