Django TemplateSyntaxError-'staticfiles'不是注册的标记库 [英] Django TemplateSyntaxError - 'staticfiles' is not a registered tag library
本文介绍了Django TemplateSyntaxError-'staticfiles'不是注册的标记库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
升级到Django 3.0后,我得到以下TemplateSyntaxError
:
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
这是我的模板
{% load staticfiles %}
<img src="{% static 'my_image.html' %}">
推荐答案
{% load staticfiles %}
和{% load admin_static %}
是在Django 3.0中已删除.
如果模板中包含以下任何内容:
If you have any of the following in your template:
{% load staticfiles %}
{% load static from staticfiles %}
{% load admin_static %}
您应该将标签替换为:
{% load static %}
这篇关于Django TemplateSyntaxError-'staticfiles'不是注册的标记库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文