Skip to content

Use {% load static %} instead of {% load staticfiles %} in templates #5773

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Jan 26, 2018
Merged

Use {% load static %} instead of {% load staticfiles %} in templates #5773

merged 1 commit into from
Jan 26, 2018

Conversation

jdufresne
Copy link
Contributor

Starting with Django 1.10, it is preferable to load the static template tag library instead of staticfiles. If django.contrib.staticfiles is in INSTALLED_APPS, the static template tag library will use the staticfiles app to determine static paths. For additional details, see:

https://docs.djangoproject.com/en/dev/releases/1.10/#django-contrib-staticfiles

The static template tag now uses django.contrib.staticfiles if it’s in INSTALLED_APPS. This is especially useful for third-party apps which can now always use {% load static %} (instead of {% load staticfiles %} or {% load static from staticfiles %}) and not worry about whether or not the staticfiles app is installed.

The staticfiles template tag library will be deprecated and removed in a future Django version.

Starting with Django 1.10, it is preferable to load the static template
tag library instead of staticfiles. If django.contrib.staticfiles is in
INSTALLED_APPS, the static template tag library will use the staticfiles
app to determine static paths. For additional details, see:

https://docs.djangoproject.com/en/dev/releases/1.10/#django-contrib-staticfiles

> The static template tag now uses django.contrib.staticfiles if it’s in
> INSTALLED_APPS. This is especially useful for third-party apps which
> can now always use {% load static %} (instead of {% load staticfiles
> %} or {% load static from staticfiles %}) and not worry about whether
> or not the staticfiles app is installed.

The staticfiles template tag library will be deprecated and removed in a
future Django version.
@rpkilby rpkilby merged commit 052a20c into encode:master Jan 26, 2018
@rpkilby
Copy link
Member

rpkilby commented Jan 26, 2018

Thanks @jdufresne!

@jdufresne jdufresne deleted the load-static branch January 27, 2018 02:36
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this pull request Nov 17, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants