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++异常机制不能同时处理两个或两个以上的异常.多个异常同时存在的情况下, ...
随机推荐
- 【dependencyManagement版本管理】dependencies.dependency.version is missing
maven 的gav的v(版本问题) 报错dependencies.dependency.version is missing 出现的场景 一个项目中有多个模块 父模块中出现dependencies. ...
- PhpStorm 配置本地文件自动上传至服务器
目的:本地文件夹下的文件实时同步至指定服务器的文件夹,减少代码移植的成本和风险 添加一个SFTP连接 Tools - Deployment - Browse Remote Host 配置连接参数 Co ...
- SQLFlow使用中的注意事项--设置篇
SQLFlow 是用于追溯数据血缘关系的工具,它自诞生以来以帮助成千上万的工程师即用户解决了困扰许久的数据血缘梳理工作. 数据库中视图(View)的数据来自表(Table)或其他视图,视图中字段(Co ...
- [刷题] 1022 D进制的A+B (20分)
思路 设t = A + B,将每一次t % d的结果保存在int类型的数组s中 然后将t / d,直到 t 等于 0为止 此时s中保存的就是 t 在 D 进制下每一位的结果的倒序 最后倒序输出s数组 ...
- [刷题] 454 4Sum II
要求 给出四个整型数组ABCD,寻找有多少 i j k l 的组合,使得A[i]+B[j]+C[k]+D[l]=0 ABCD元素个数均为N,0<=N<=500 示例 输入: A = [ 1 ...
- Ubuntu 15.04下安装Docker
最近听说Docker很火,不知道什么东西,只知道是一个容器,可以跨平台.闲来无事,我也来倒弄倒弄.本文主要介绍:Ubuntu下的安装,以及基本的入门命令介绍:我的机器是Ubuntu 15.04 64位 ...
- 如何在CentOS 7上安装Htop
在本教程中,我们将向您介绍如何在CentOS 7服务器上安装和配置Htop.对于那些不知道的人,Htop 是为Linux编写的一个交互式实时系统监视进程查看器.它被设计为替代Unix程序的顶部.它显示 ...
- Zabbix 监控介绍
Zabbix 监控介绍 1.Zabbix监控架构 2.Zabbix 优点 开源无软件成本投入 Server对设备性能要求低 支持设备多,自带多种监控模板 支持分布式集中管理,有自动发现功能,可以实现自 ...
- 配置文件修改java安全级别和站点信息
配置文件修改java安全级别和站点信息原创Green_1001 最后发布于2015-04-22 23:00:09 阅读数 516 收藏展开 通过配置文件修改java安全级别 配置文件名称为deploy ...
- 1.1Ubuntu安装
在虚拟机中安装 Ubuntu 步骤 安装前的准备和基本安装 设置语言环境 安装常用软件 1. 安装前的准备和基本安装 1.1 安装前的准备 访问 http://cn.ubuntu.com/downlo ...