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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了is not a registered tag library. Must be one of:相关的知识,希望对你有一定的参考价值。

自定义模板标签,使用时报以下错误

TemplateSyntaxError at /my_customer_tags/
‘admin_tags‘ is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_static
admin_urls
cache
custom_tags
i18n
kingadmin_tags
l10n
log
static
staticfiles
tz

解决方法:
在proj.settings中做如下设置

TEMPLATES = [
{
    ‘BACKEND‘: ‘django.template.backends.django.DjangoTemplates‘,
    ‘DIRS‘: [],
    ‘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‘,
            ‘app.apptemplates.load_setting‘,

        ],

        ‘libraries‘:{
                        ‘my_customer_tags‘:  ‘yourapp.templatetags.my_customer_tags‘,

            }
    },
},
]

以上是关于is not a registered tag library. Must be one of:的主要内容,如果未能解决你的问题,请参考以下文章

ERROR: Repository not found. ////Git, but is not registered in the Settings.

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

This system is not registered to Red Hat Subscription Management.

python Django2.X,报错 ‘learning_logs ’is not a registered namespace,如何解决?

red hat 6.5 红帽企业Linux.6.5 yum This system is not registered to Red Hat Subscription Management. You

IntelliJ IDEA提示URI is not registered几种解决方法