使用Django开发项目,使用模板和静态变量,debug后出现错误:
'staticfiles' is not a registered tag library.Must be one of:
admin_list
admin_modify
admin_static
admin_urls
cache
i18n
l10n
log
static
tz
经过查询后得知:
我使用的Django版本为3.0.3,此版本已经弃用staticfiles作为标签模板库。
https://docs.djangoproject.com/en/dev/internals/deprecation/#deprecation-removed-in-3-0
解决方法:
将原本的
{% load staticfiles %}
改为
{% load static %}
重新debug成功。