Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
654 B
5
Indexable
Never
app = FastAPI()
templates = Jinja2Templates(directory="templates")


# `GET /` should render the `strompris.html` template
# with inputs:
# - request
# - location_codes: location code dict
# - today: current date
@app.get("/", response_class=HTMLResponse)
def render(request: Request,
           location_codes: Optional[dict] = LOCATION_CODES,
           today: Optional[datetime.date] = datetime.date.today()):
    return templates.TemplateResponse("strompris.html", {"request": request,
                                                         "location_codes": location_codes,
                                                         "today": today})