'staticfiles' is not a registered tag library. Must be one of:

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

ROOT_URLCONF = ''

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')]
        ,
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                
            ],
            #添加下面内容
            'libraries': { # Adding this section should work around the issue.
                'staticfiles' : 'django.templatetags.static',
            },
        },
    },
]

 

posted @ 2021-09-28 09:13  香菜哥哥  阅读(624)  评论(0编辑  收藏  举报