1.错误信息 :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
2.确定是正常创建的过滤器和自定义标签
1.文件夹名称为“templatetages"
2.register = template.Library()
3.解决方法
setting.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR,"mydjangoapp/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':{
'my_filter':'mydjangoapp.templatetages.my_filter', # 名:文件路径用点链接
},
},
},
]
本文摘抄自:醒悟的笨蛋
本文作自身学习过程记录,非原创,侵删。