In my Django project the application my_app has a template which references a javascript static file:
<script src="{% static 'my_app/my_script.js' %}"></script>
Once I installed my_script.js in my_app/templates/my_app, everything seemed to work. At some point I overwrote my_script.js with a different script, such that my_script.js has a different content now.
However, when I load my_app with my browser, it loads the old my_script.js, although it does not exist anymore. How can I resolve it? Thanks.
You can add a cache-busting ?get=parameter. I like to define a {% statichash %} template tag that reads the file and appends a hash of the file contents as a get param. This is similar, uses the file's modified time instead of hash, but same idea:
https://bitbucket.org/ad3w/django-sstatic/src/4401a4bc3058618dfc2eafaee6a23d287a99ede5/sstatic/templatetags/sstatic.py?at=default