Spaces:
Runtime error
Runtime error
File size: 669 Bytes
247d94e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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) |