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

解决办法:在setting.py的TEMPLATES‘DIRS‘[]加入模版路径

os.path.join(BASE_DIR, ‘templates‘)
TEMPLATES = [
    {
        ‘BACKEND‘: ‘django.template.backends.django.DjangoTemplates‘,
        ‘DIRS‘: [os.path.join(BASE_DIR, ‘templates‘)],
        #os.path.join(BASE_DIR, ‘templates‘)没了这句,
        # 会显示django.template.exceptions.TemplateDoesNotExist: index.html
        ‘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‘,
            ],
        },
    },
]
时间: 2024-08-05 19:36:16

Django 找不到模版报错" django.template.exceptions.TemplateDoesNotExist: index.html"的相关文章

报错django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

使用xadmin源码安装时会遇到报错,原因是依赖包没有安装,方法一是官方说明,方法二亲测有效 方法一:https://github.com/sshwsfc/xadmin/blob/master/requirements.txt 方法二: pip install future six httplib2 django-import-export>=0.5.1 pip uninstall django-crispy-forms django-formtools 报错django.core.except

Django:创建用户模型报错: (admin.E108) The value of 'list_display[4]'解决方案

参考资料:虫师-<web接口开发与自动化测试:基于python语言> 日常学习Django框架中,创建了用户模型,但是页面功能验证时候,提示不能进行列表字段操作,debug好久,才找到问题原因,心累... 下面是大概过程和解决方案... models.py文件代码: 1 from django.db import models 2 3 # Create your models here. 4 # 发布会表 5 class Event(models.Model): 6 name = models

django,访问xadmin后台报错Exception Value: (1146, &quot;Table &#39;django.xadmin_usersettings&#39; doesn&#39;t exist&quot;)

报错如图: 解决,执行迁移表命令: python manage.py makemigrations python manage.py migrate 生成xadmin数据库表之后再去访问: 如图: 访问成功: django,访问xadmin后台报错Exception Value: (1146, "Table 'django.xadmin_usersettings' doesn't exist") 原文地址:https://www.cnblogs.com/xiamaojjie/p/125

Couldn&#39;t load libPassword from loader:NDK开发中C文件编译成cpu的so类库时,找不到类库报错的原因之一

LogCat输出: 03-03 12:42:32.665: E/AndroidRuntime(32432): FATAL EXCEPTION: main03-03 12:42:32.665: E/AndroidRuntime(32432): Process: com.toro.passwordencode, PID: 3243203-03 12:42:32.665: E/AndroidRuntime(32432): java.lang.UnsatisfiedLinkError: Couldn't

报错: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

描述:使用Hibernate登陆验证时故意输入没有的用户名,所产生的错误. 错误代码: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 /*      * 根据客户的用户名查找客户信息      */     @Override     public User getUserByUserName(String userName) {         String hql="from User where userName=?";         Session s

Visual Studio 新建项目报错&quot; this template attempted to load component assembly &#39;NuGet.VisualStudio.Interop, ….&quot;.

"Error: this template attempted to load component assembly 'NuGet.VisualStudio.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.". 解决: I believe you do not have NuGet Package Manager extension installed. If not, you ca

python操作redis报错:redis.exceptions.DataError: ZADD allows either &#39;nx&#39; or &#39;xx&#39;, not both解决方案

一.问题描述 sorted set操作执行:print(connect.zadd('grade', 'bob', 98, 'mike' ,100))时报错redis.exceptions.DataError: ZADD allows either 'nx' or 'xx', not both 二.出现该问题原因 上面的connect.zadd('key','value1','score1','value2','score2')写法是redis-py 3.0之前的版本 在redis-py 3.0版

关于报错:django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None

线上项目转到测试,setting连接本地数据库报错. 1 django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.3 or newer is required; you have 0.7.11.None Python安装路劲下的Python36-32\Lib\site-packages\django\db\backends\mysql\base.py文件下. 注释下面语句 1 if version < (1, 3, 3): 2 r

【Django】Mac 安装pip3-install-mysqlclient 报错

1.首先在pip3-install-mysqlclient时报错 mysql_config not found 2.逛了一些博客 让安装mysql或者mysql-connector-c 我安装了后者还是报错,现在报了这个错误 File "<string>", line 1, in <module> File "/private/var/folders/2f/r1pwfcp521q7z9kd240tr3700000gn/T/pip-build-u8yhU