django.template.exceptions.TemplateSyntaxError: 'staticfiles' is not a registered tag library.

【问题描述】

       今天在构建django-rest-swagger的时候报了如下的错误:

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

【解决办法】

       在setting.py中添加如下内容:

'libraries': {  # Adding this section should work around the issue.
    'staticfiles': 'django.templatetags.static',
},

猜你喜欢

转载自blog.csdn.net/gdkyxy2013/article/details/105509101