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',
},

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章