当前位置: 首页 > 工具软件 > staticfiles > 使用案例 >

django报错‘staticfiles‘ is not a registered tag library

井洲
2023-12-01

django在前端模板中使用{% load staticfiles %}会报错,报错信息如下:

'staticfiles' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_urls
cache
i18n
l10n
log
static
tz

解决方法

修改前端模板为{% load static %}

因为在django3.x中这部分做了修改,对于:

{% load staticfiles %}
{% load static from staticfiles %}
{% load admin_static %}

都统一改为{% load static %}

 类似资料: