static

Configure staticfiles directory for manage.py collectstatic

August 21, 2022
static

Starting new project it’s have no configured staticfiles directory configured by default, so it is not able you to use python manage.py collectstatic script to generate staticfiles bundle. It is small tip how to configure staticfiles fast and easy, just add this line to your settings.py file.

...

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. ...