aio-libs / aio-libs/aiohttp-jinja2
How do I employ cache busting in a template?
- Vorherrschende Sprache
- Python
- Sterne
- 240
- Forks
- 61
- Ø Merge
- 2 Min.
- Gemergte PRs (30 T.)
- 4
Beschreibung
### Discussed in https://github.com/aio-libs/aiohttp-jinja2/discussions/590
Originally posted by **ugyballoons** July 22, 2022
Hi,
I'm enjoying working with aiohttp and jinja2.
It's not clear to me how to employ cache busting. Please could someone help?
In the setup I have:
```
sub_app.add_routes(
[
web.static(
"/static",
Path(__file__).parent / "static",
name="static",
append_version=True,
),
]
)
sub_app["static_root_url"] = "/path-to/static"
env = aiohttp_jinja2.get_env(sub_app)
env.globals.update(
zip=zip,
url_for=web.Resource.url_for
)
```
and in the template I have:
``
I feel that I shouldn't be passing `url_for` in the globals but if I don't, then jinja complains that there's no such function. Where am I going wrong?
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.