#23798 closed New feature (wontfix)
Improve "static" template tag to generate staticfiles revision
Reported by: | Alexey Zankevich | Owned by: | nobody |
---|---|---|---|
Component: | contrib.staticfiles | Version: | dev |
Severity: | Normal | Keywords: | templatetags staticfiles |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Currently "static" template tag generates a link without revision, however it would be a good mechanism to force udpate static files on client side.
Current implementation:
{% static "path/to/file.js" %} -> /static/path/to/file.js
Proposal:
{% static "path/to/file.js" %} -> /static/path/to/file.js?<revision>
where <revision> defined as STATIC_REVISION variable in settings. If STATIC_REVISION is not defined, "static" tag will failback to the current behavoir.
I can make a fix if it's considered as a good idea.
Change History (3)
comment:1 by , 10 years ago
Version: | 1.7 → master |
---|
comment:2 by , 10 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:3 by , 10 years ago
The built-in ManifestStaticFilesStorage is also available. It adds a revision to the filename based on the file contents and works without an additional setting.
Hi! Thanks for the suggestion.
There are several third-party solutions already that will append a revision to your files (as well as concatenating/minifying them), without even the need to maintain a manual
STATIC_REVISION
setting. See for instance django-pipeline.I am not sure that the solution you propose (with the addition of a new setting) is clearly enough the best option that it should be integrated with Django. It should be easy to implement as a third-party template tag extending the built-in
static
tag.