在访问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:的更多相关文章

  1. 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 ...

  2. Django 自定义模板标签 报错django.template.exceptions.TemplateSyntaxError: '####' is not a registered tag library. Must be one of:

    我写代码遇到这个错误,但是发现程序没有写错,好像是程序有缓存,重新运行几次就好了. 自定义模板标签,可以不用写views,url直接通过自定义函数把变量传给模板. 具体实现: 1.在app下新建Pyt ...

  3. django.template.exceptions.TemplateDoesNotExist: rest_framework/api.html

    django.template.exceptions.TemplateDoesNotExist: rest_framework/api.html setting文件中的 INSTALLED_APPS加 ...

  4. django.template.exceptions.TemplateDoesNotExist: login.html 错误处理

    登陆Login界面时候报错 Internal Server Error: /login/ Traceback (most recent call last): File , in inner resp ...

  5. Django 找不到模版报错" django.template.exceptions.TemplateDoesNotExist: index.html"

    解决办法:在setting.py的TEMPLATES‘DIRS'[]加入模版路径 os.path.join(BASE_DIR, 'templates') TEMPLATES = [ { 'BACKEN ...

  6. django.template.exceptions.TemplateDoesNotExist: index.html

    django.template.exceptions.TemplateDoesNotExist: index.html 在网上查了下,setting中 TEMPLATES 的 'DIRS' 需要添加o ...

  7. django.template.exceptions.TemplateDoesNotExist: login.html报错

    前言 在某一次按以前的步骤使用Django    “django.template.exceptions.TemplateDoesNotExist: login.html”错误,在以为是html文件出 ...

  8. django找不到模板的错误处理django.template.exceptions.TemplateDoesNotExist: blog/list.html

    错误提示如下图: 程序出错对于程序员而言是最常见的,一般解决的要点是看清错误提示(读懂英文很重要) 根据错误提示 blog\list.html这个文件不存在,也就是没找到资源 这个时候需要去检查有没有 ...

  9. Django.template框架 template context (非常详细)

    前面的章节我们看到如何在视图中返回HTML,但是HTML是硬编码在Python代码中的 这会导致几个问题: 1,显然,任何页面的改动会牵扯到Python代码的改动 网站的设计改动会比Python代码改 ...

随机推荐

  1. 5w 字 | 172 图 | 超级赛亚级 Spring Cloud 实战

    一.PassJava 项目简介 PassJava-Learning 项目是 PassJava(佳必过)项目的学习教程.对架构.业务.技术要点进行讲解. PassJava 是一款 Java 面试刷题 的 ...

  2. Windows10通过NFS挂载linux目录

    大致分为以下三大步骤: 一.启动NFS服务器 二.启动NFS客户端 三.挂载NFS目录 工具: win10.虚拟机Ubuntu18.0系统 一. 启动linux的NFS服务端: 以下均为Ubuntu操 ...

  3. jmeter录制请求

    用了一段时间的jmeter感觉比LR方便很多,界面也比较简洁,开源免费,配置环境也方便,LR简直没法比,但唯一的是功能没有LR强大,毕竟是免费的,要求别那么高. 下面开始进入正题,配置环境和下载就不多 ...

  4. Jmeter(二十九) - 从入门到精通 - Jmeter Http协议录制脚本工具-Badboy2(详解教程)

    1.简介 上一篇文中已经对Badboy做了一个基本上详细完整的介绍,这一篇宏哥带你们实战一下,这一篇主要讲解和分享:录制和运行脚本.参数化 首先让我们使用N模式录制一个脚本,测试用例编号为:1.1.1 ...

  5. 项目开发中的git简单使用

    原文地址: https://www.zhuyilong.fun/tech/the-blog-git.html 示例远程仓库地址: https://github.com/zhu-longge/gitWo ...

  6. 企业安全05-Fastjson <=1.2.47反序列化RCE漏洞(CNVD-2019-22238)

    Fastjson <=1.2.47反序列化RCE漏洞(CNVD-2019-22238) 一.漏洞描述 Fastjson 是阿里巴巴的开源JSON解析库,它可以解析 JSON 格式的字符串,支持将 ...

  7. [Android systrace系列] systrace入门第一式

    转载请注明出处:https://www.cnblogs.com/zzcperf/p/13978915.html Android systrace是分析性能问题最称手的工具之一,可以提供丰富的手机运行信 ...

  8. Python使用property函数定义属性访问方法如果不定义fget会怎么样?

    我们知道Python使用property函数定义属性访问方法时的语法如下: 实例属性=property(fget=None, fset=None, fdel=None, doc=None) 而是要@p ...

  9. url的组成结构信息

    http://www.aspxfans.com:8080/news/index.asp?boardID=5&ID=24618&page=1#name 从上面的URL可以看出,一个完整的 ...

  10. 第11.14节 正则表达式转义符和Python转义符相同引发问题的解决办法

    正则表达式使用反斜杠('\')来把特殊字符转义成普通字符(为了方便称为"正则表达式转义"),而反斜杠在普通的 Python 字符串里也是转义符(称为"字符串转义" ...