Output files containing hashes of when static files were last updated.
Installing
- Run
pip install git+https://github.com/marinko-peso/django-static-hashes.git
- Add 'static_hashes' to
INSTALLED APPS
- Add the following to your settings:
STATIC_HASHES_STATIC_DIRS = ... #list of folders containing static files you want to get hashes for
STATIC_HASHES_OUTPUT_DIR = ... #path/to/output/javascript/and/json
Create the hashes
- Run
manage.py collect_static_hashes
. This may take some time. - Take a look at the files defined in STATIC_HASHES_OUTPUT_DIR
Use the hashes in the browser
- Add
{% load static_hashes_tags %}
to your template - Add
{% get_static_hashes %}
to your template - In javascript you can now acess
hashes
.
Related to this blog post