2 parents 1905ace + 6bbc05e commit 97efcd6Copy full SHA for 97efcd6
1 file changed
examples/sample_app/configurable_server.py
@@ -53,7 +53,11 @@ async def get_reference_audios():
53
54
@app.get("/", response_class=HTMLResponse)
55
async def read_root(request: Request):
56
- return templates.TemplateResponse("index.html", {"request": request})
+ # Use the modern Starlette TemplateResponse(request, name, context) signature.
57
+ # The old "TemplateResponse(name, context)" form puts ``request`` into the
58
+ # context dict, and jinja2 tries to hash the cache key as ``(name, context)``
59
+ # which fails because ``request`` is an unhashable mapping. See issue #62.
60
+ return templates.TemplateResponse(request, "index.html", {})
61
62
63
if __name__ == "__main__":
0 commit comments