在访问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. FL studio系列教程(十七):FL Studio走带面板介绍

    FL Studio走带面板主要是用来控制播放.录音以及调整歌曲速度的,除此之外还可以用来选择样本剪辑.下面就来详细地看一下这部分菜单. 1.样本/歌曲模式 样本/歌曲模式主要是用来切换样本和歌曲两种模 ...

  2. python ddt实现数据驱动

    首先安装ddt模块,命令:pip install ddt 通常情况下,data中的数据按照一个参数传递给测试用例,如果data中含有多个数据,以元组,列表,字典等数据,需要自行在脚本中对数据进行分解或 ...

  3. Java基础教程——多态

    直观地说,多态就是"一个对象,多种形态 ".比如观世音菩萨就有多种形态-- 每个人都有多种形态-- 具体地讲,多态是指"同一个对象.同一个方法(函数),表现出不同的行为& ...

  4. redis 压测与乐观锁

    单线程没有出现并发问题. 链接太多爆炸了 把连接改到50,没有问题 改回1000: emmm159,看来相当一部分拒绝了 并且8180-10000到头了 cpu爆炸了 观察下这种程度的并发用乐观锁 一 ...

  5. 加快alter table

    mysql的alter table操作的性能对打表来说是个大问题. mysql执行大部分修改表结构的方法是用新的结构创建一个空表,从旧表中查出所有的数据插入新表,然后删除旧表.这样操作就可能需要花费很 ...

  6. Tiops评测

    一.前言 前几天参加了一个新钛云服公有课,才了解到这家公司有发布自己产品Tiops云运维堡垒机. 在此之前有了解过JumpServer,可以完美支持windows和linux server运维管理,以 ...

  7. java面试复习重点:类的管理及常用工具,教你抓住面试的重点!

    java复习: 类的管理及常用工具类 包 写在程序文件的第一行 一个Java 源文件中只能声明一个包, 且声明语句只能作为源文件的第一条指令 导入类能导入非public类,但是不能用因为在其他包缺省的 ...

  8. LeetCode 048 Rotate Image

    题目要求:Rotate Image You are given an n x n 2D matrix representing an image. Rotate the image by 90 deg ...

  9. rest-framework 解析器

    一 解析器的作用: 根据请求头 content-type 选择对应的解析器对请求体内容进行处理. 有application/json,x-www-form-urlencoded,form-data等格 ...

  10. 三万字无坑搭建基于Docker+K8S+GitLab/SVN+Jenkins+Harbor持续集成交付环境

    写在前面 最近在 K8S 1.18.2 版本的集群上搭建DevOps环境,期间遇到了各种坑.目前,搭建环境的过程中出现的各种坑均已被填平,特此记录,并分享给大家! 文章和搭建环境所需要的yml文件已收 ...