Configuration

Add Hash to Static Files Names in Django

August 16, 2022
Configuration
static

It is very useful to append hash at the end of static files name such as js/css to prevent situation when website visitors after update still have old version of the file in browser cache. Django have built-in tool which automatically add hash to the all static files of Django project on python manage.py collectstatic You need just to add this line to the settings.py file STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' That’s all. ...