When do you use {% load static %} vs {% load staticfiles %}? What's the difference between {% load static %} and {% load staticfiles %}?
That's what I aim to answer in this video.
Whenever you use load staticfiles or load static, it loads a Django template tag. In-order to use this template tag, you have to set up your static file directories. After that, you import the CSS, Javascript or Images from these locations.
The difference between {% load staticfiles %} vs {% load static %} and which one you should use comes down to what version of Django you have. Before Django 1.10, you would use {% load staticfiles %}. From Django version 1.10 and up to 2.1, you have the option to use either {% load staticfiles %} or {% load static %}. From Django 2.1 and onward, {% load staticfiles %} is deprecated in favor of {% load static %}.
Therefore, if you have the latest version of Python, simply use {% load static %} and not {% load staticfiles %}.
Helpful links:
https://code.djangoproject.com/ticket...
https://stackoverflow.com/questions/3...
https://docs.djangoproject.com/en/1.9...
https://docs.djangoproject.com/en/2.2...
https://docs.djangoproject.com/en/dev...
https://docs.djangoproject.com/en/2.2...
#Python #Django