Question
Asked By – Alasdair
After upgrading to Django 3.0, I get the following TemplateSyntaxError
:
In template /Users/alasdair//myproject/myapp/templates/index.html, error at line 1
'staticfiles' is not a registered tag library. Must be one of: admin_list admin_modify admin_urls cache i18n l10n log static tz
Here is my template
{% load staticfiles %}
<img src="{% static 'my_image.html' %}">
Now we will see solution for issue: Django TemplateSyntaxError – ‘staticfiles’ is not a registered tag library
Answer
If you have any of the following tags in your template:
{% load staticfiles %}
{% load static from staticfiles %}
{% load admin_static %}
Then replace it with:
{% load static %}
You have to make this change because {% load staticfiles %}
and {% load admin_static %}
were deprecated in Django 2.1, and removed in Django 3.0.
This question is answered By – Alasdair
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0