is there a way to append the etag at the end of the static resources in django
In rails, if I import a css file or javascript file, the url will be like this
<script type="text/javascript" src="some.js?<ETag here>"></script>
if I upgrade the some.js the etag will be changed, so my browser can cache the static resource smartly and update the cache when necessary.
Is there a way to do it in 开发者_运维技巧django?
Maybe django-static can help you on this ..
django_static
is a Django app that enables as various template tags for better serving your static content. It basically rewrites references to static files and where applicable it does whitespace optmization of the content.By making references to static content unique (timestamp included in the name) you can be very aggressive with your cache-control settings without ever having to worry about upgrading your code and worrying about visitors using an older version.
This solution is, as <jldupont>
pointed out, one, which does not relate to HTTP ETags.
Besides django-static mentioned by The MYYN, these projects will do what you need and also contain other highly useful features like compression and concatenation:
django-compress
django_compressor
精彩评论