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++异常机制不能同时处理两个或两个以上的异常.多个异常同时存在的情况下, ...
随机推荐
- 中国石油大学(华东)数学实验(MATLAB)复习
作者:张世琛 函数的导数 $$ 求函数y=log(x+\sqrt{1+x^2})的一阶和二阶导数 $$ syms x; y=log(x+sqrt(1+x^2)); dydx=diff(y,x); dy ...
- 【实用小技巧】Access denied for user 'root'@'localhost' 报错解决
到mysql安装目录修改my.ini文件,在文件末尾追加一句 skip-grant-tables 然后重启mysql服务即可
- 修复火狐主页被篡改成hao123的办法
1:问题描述: 网上下载了某绿色小工具使用,火狐浏览器的主页被篡改为 https://www.hao123.com/?tn=96895497_hao_pg,网上找了很多主页修复工具包括火狐的解决方法以 ...
- 剖析XAML语言
这节剖析一下XAML(读作:zaml)--这一WPF中的UI设计语言. XAML 在wpf中,UI部分使用xaml语言来编写,xaml语言是由xml语言派生而来的语言,所以在xaml中我们可以看到很多 ...
- 脱壳入门----常见的寻找OEP的方法
一步直达法 所谓的一步直达法就是利用壳的特征.壳一般在执行完壳代码之后需要跳转到OEP处,而这个跳转指令一般是call ,jmp ,push retn类型的指令,而且因为壳代码所在的区段和OEP代码所 ...
- Electron-Vue3-Vadmin后台系统|vite2+electron桌面端权限管理系统
基于vite2.x+electron12桌面端后台管理系统Vite2ElectronVAdmin. 继上一次分享vite2整合electron搭建后台框架,这次带来的是最新开发的跨桌面中后台权限管理系 ...
- Jenkins 基础篇 - 基础设置
站点设置 刚搭建好 Jenkins 环境,你还需要做一些简单设置,让我们的 Jenkins 看起来是这么一回事,特别是你要用于生产环境的时候.首先就是域名配置,如果你为 Jenkins 服务分配了一个 ...
- leecode之Implement strStr()
KMP算法的实现: #include <stdio.h> #include <string.h> #include <stdlib.h> int strStr(ch ...
- IPC机制key值的各位组成
key_t ftok(const char *_pathname, int _proj_id) key值的第31~24位为ftok()第二个参数的低8位: key值的第23~16位为ftok()第一个 ...
- IIS 10 设置FTP Passive Mode 固定端口
1. Run [Start] - [Server Manager] and Click [Tools] - [Internet Information Services (IIS) Manager]. ...