08:'my_tag' is not a registered tag library. Must be one of
确保每次修改模板标签时都重新启动 Django 开发服务器(或确保它自己重新启动)。如果服务器没有重新启动,Django 将不会注册标签。
从 django 1.9 开始,您可以在如下设置中加载这些新标签/过滤器:
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_templatetag': 'app.templatetags.my_templatetag', }
},
},
]
确保您没有遗漏以下任何步骤:
在您的应用程序文件夹中创建一个与models.py 和views.py 处于同一级别的名为“templatetags”的文件夹
您的应用程序必须位于 settings.py 中的 INSTALLED_APPS 中
templatetags 文件夹必须有 __init__.py
重启django服务器
08:'my_tag' is not a registered tag library. Must be one of的更多相关文章
- 关于'selffilter' is not a registered tag library. Must be one of:
报错代码: 'selffilter' is not a registered tag library. Must be one of: admin_list admin_modify admin_st ...
- django.template.exceptions.TemplateSyntaxError: 'article_tags' is not a registered tag library.
django.template.exceptions.TemplateSyntaxError: 'article_tags' is not a registered tag library. Must ...
- django.template.exceptions.TemplateSyntaxError: 'static' is not a registered tag library. Must be one of:
在访问web页面时报错,详细日志如下: django.template.exceptions.TemplateSyntaxError: 'staticfiles' is not a registere ...
- 【django-simpleui】‘simpletags‘ is not a registered tag library报错的解决方法
1:创建 templatetags文件夹 2:创建simpletags.py文件将内容粘贴进去,在下面 3:setting.py添加文件指定: 1 TEMPLATES = [ 2 { 3 'BACK ...
- Django 自定义模板标签 报错django.template.exceptions.TemplateSyntaxError: '####' is not a registered tag library. Must be one of:
我写代码遇到这个错误,但是发现程序没有写错,好像是程序有缓存,重新运行几次就好了. 自定义模板标签,可以不用写views,url直接通过自定义函数把变量传给模板. 具体实现: 1.在app下新建Pyt ...
- 报错:严重: Servlet.service() for servlet [jsp] in context with path [/20161116-Struts2-6] threw exception [/index.jsp (line: 13, column: 20) No tag "textfiled" defined in tag library imported with prefix
严重: Servlet.service() for servlet [jsp] in context with path [/20161116-Struts2-6] threw exception [ ...
- JSTL的全称:JSP Standard Tag Library, jsp 标准标签库
JSTL的全称:JSP Standard Tag Library, jsp 标准标签库 JSTL的作用 提供给Java web开发人员一个标准通过的标签函数库和EL来取代传统直接在页面上嵌入j ...
- 使用jstl报错:Can not find the tag library descriptor for “http://java.sun.com/jstl/core”
使用jstl报错:Can not find the tag library descriptor for “http://java.sun.com/jstl/core” 出现这个错误的原因是项目中没有 ...
- Effective C++ 条款08:别让异常逃离析构函数
1.别让异常逃离析构函数的原因 <Effective C++>第三版中条款08建议不要在析构函数中抛出异常,原因是C++异常机制不能同时处理两个或两个以上的异常.多个异常同时存在的情况下, ...
随机推荐
- 【js】Leetcode每日一题-数组异或操作
[js]Leetcode每日一题-数组异或操作 [题目描述] 给你两个整数,n 和 start . 数组 nums 定义为:nums[i] = start + 2*i(下标从 0 开始)且 n == ...
- PHP中文转拼音扩展
Pinyin 基于 CC-CEDICT 词典的中文转拼音工具,更准确的支持多音字的汉字转拼音解决方案. 安装 使用 Composer 安装: $ composer require "over ...
- Git 系列教程(7)- 撤销操作
撤销操作 在任何一个阶段,你都有可能想要撤销某些操作 有些撤销操作是不可逆的 --amend 修补提交 有时候我们提交完了才发现漏掉了几个文件没有添加,或者提交信息写错了. 此时,就可以运行带有 -- ...
- .NET平台系列7 .NET Core 体系结构详解
系列目录 [已更新最新开发文章,点击查看详细] .NET Core 是基于.NET Framework 为基础,借鉴了其优秀的思想与强大的功能,经过重新设计与构建,实现了.NET Fram ...
- Scrum Meeting 3
Basic Info where:三号教学楼 when:2020/4/27 target: 简要汇报一下已完成任务,下一步计划与遇到的问题 Progress Team Member Position ...
- Spring Cloud Alibaba(11)---Sentinel+Nacos持久化
Sentinel+Nacos持久化 有关Sentinel之前有写过两篇 Spring Cloud Alibaba(9)---Sentinel概述 Spring Cloud Alibaba(10)--- ...
- path自定义转换器
register-converter用于注册转换器
- [Python] 条件 & 循环
条件语句 不加 () 结尾加 : elif else 和 if 成对使用 省略判断条件 String:空字符串为False,其余为True int:0为False,其余为True Bool:True为 ...
- pycharm编辑器,各种设置及配置修改
Pycharm中如何设置默认自动换行 只对当前文件有效的操作:菜单栏->View -> Active Editor -> Use Soft Wraps: 如果想对所有文件都有效,就要 ...
- C语言的指针数组与指针数组
一.指针数组与指针数组 1,指针数组 顾名思义,即一个元素全部是指针的数组,其形式与普通数组相似,形式如 *a[N]. 在理解指针数组的使用方式前,我先来说下我个人对数组的理解. 比如一维整形数组(形 ...