django.template.exceptions.TemplateSyntaxError: 'static' is not a registered tag library. Must be one of:
在访问web页面时报错,详细日志如下:
django.template.exceptions.TemplateSyntaxError: 'staticfiles' is not a registered tag library. Must be one of:
admin_list
admin_modify
admin_urls
cache
i18n
l10n
log
rest_framework
static
tz
解决办法:
指定staticfiles
settings.py 文件中TEMPLATES中的OPTIONS添加 如下代码
'libraries': {
'staticfiles': 'django.templatetags.static',
},
完整的 TEMPLATES如下:
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',
],
'libraries': {
'staticfiles': 'django.templatetags.static',
},
},
},
]
django.template.exceptions.TemplateSyntaxError: 'static' is not a registered tag library. Must be one of:的更多相关文章
- 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 自定义模板标签 报错django.template.exceptions.TemplateSyntaxError: '####' is not a registered tag library. Must be one of:
我写代码遇到这个错误,但是发现程序没有写错,好像是程序有缓存,重新运行几次就好了. 自定义模板标签,可以不用写views,url直接通过自定义函数把变量传给模板. 具体实现: 1.在app下新建Pyt ...
- django.template.exceptions.TemplateDoesNotExist: rest_framework/api.html
django.template.exceptions.TemplateDoesNotExist: rest_framework/api.html setting文件中的 INSTALLED_APPS加 ...
- django.template.exceptions.TemplateDoesNotExist: login.html 错误处理
登陆Login界面时候报错 Internal Server Error: /login/ Traceback (most recent call last): File , in inner resp ...
- Django 找不到模版报错" django.template.exceptions.TemplateDoesNotExist: index.html"
解决办法:在setting.py的TEMPLATES‘DIRS'[]加入模版路径 os.path.join(BASE_DIR, 'templates') TEMPLATES = [ { 'BACKEN ...
- django.template.exceptions.TemplateDoesNotExist: index.html
django.template.exceptions.TemplateDoesNotExist: index.html 在网上查了下,setting中 TEMPLATES 的 'DIRS' 需要添加o ...
- django.template.exceptions.TemplateDoesNotExist: login.html报错
前言 在某一次按以前的步骤使用Django “django.template.exceptions.TemplateDoesNotExist: login.html”错误,在以为是html文件出 ...
- django找不到模板的错误处理django.template.exceptions.TemplateDoesNotExist: blog/list.html
错误提示如下图: 程序出错对于程序员而言是最常见的,一般解决的要点是看清错误提示(读懂英文很重要) 根据错误提示 blog\list.html这个文件不存在,也就是没找到资源 这个时候需要去检查有没有 ...
- Django.template框架 template context (非常详细)
前面的章节我们看到如何在视图中返回HTML,但是HTML是硬编码在Python代码中的 这会导致几个问题: 1,显然,任何页面的改动会牵扯到Python代码的改动 网站的设计改动会比Python代码改 ...
随机推荐
- word-结构图
公司单位上下级结构图 总经理 助理 副总经理 财务总监 财务部 人事部 行政部 出口部 进口部 运营总监 储运部 信息部 首先将内容按照上下级排序正确 插入-SmartArt-根据需要选择图形,以上内 ...
- flink:StreamGraph转换为JobGraph
1 转换基本流程 2 简单来看可以分为两部分: 第一部分是通过一些util.translator.generator等类将职责进行解耦.托管和分离,期间涉及FlinkPipelineTranslati ...
- python截取视频制作动态表情包+文字
1:安装moviepy库 2:安装IPython库 代码如下: from moviepy.editor import * from IPython.display import Image def B ...
- python+selenium下载和上传文件
操作浏览器上传文件,先看代码 1 """ 2 * send_keys() 指定文件上传路径. 3 """ 4 from selenium i ...
- 精尽MyBatis源码分析 - Spring-Boot-Starter 源码分析
该系列文档是本人在学习 Mybatis 的源码过程中总结下来的,可能对读者不太友好,请结合我的源码注释(Mybatis源码分析 GitHub 地址.Mybatis-Spring 源码分析 GitHub ...
- 什么,kafka能够从follower副本读数据了 —kafka新功能介绍
最近看了kafka2.4新版本的一些功能特性,不得不说,在kafka2.0以后,kafka自身就比较少推出一些新的feature了,基本都是一些修修补补的东西.倒是kafka connect和kafk ...
- 使用Docker部署MSSQL
部署MSSQL需要2G内存 1.下载镜像 docker pull microsoft/mssql-server-linux 使用该命令就可以把数据库的docker镜像下载下来. 2.创建并运行容器 d ...
- Beego框架学习--(核心:数据交互)
Beego框架学习记录 1.beego简介 beego 是一个快速开发 Go 应用的 HTTP 框架,他可以用来快速开发 API.Web 及后端服务等各种应用,是一个 RESTful 的框架,主要设计 ...
- 20191225_关于sql中exists和not exists
exists n. 存在量词(exist的复数)v. 存在:出现:活着(exist的三单形式) 理所当然 not exists 就是不存在 那么 if exists 就是表示它引导的子句有结果集返回 ...
- PyQt(Python+Qt)学习随笔:QListView的gridSize属性
老猿Python博文目录 专栏:使用PyQt开发图形界面Python应用 老猿Python博客地址 QListView的gridSize属性用于控制视图中数据项排列所在网格的大小,gridSize默认 ...