【发布时间】:2020-07-25 20:40:32
【问题描述】:
这是发生的错误,当我从我的模板文件夹中请求一个 .html 文件时似乎会发生这种错误,但由于某些未知的原因,它无法显示并抛出我无法处理的这些错误弄清楚几天。
如果需要更多信息,我会提供给任何提供帮助的人
Traceback (most recent call last):
File "C:\Users\uknow\Desktop\Coding\GoFishFarms\venv\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\Users\uknow\Desktop\Coding\GoFishFarms\venv\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\uknow\Desktop\Coding\GoFishFarms\venv\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\uknow\Desktop\Coding\GoFishFarms\pages\views.py", line 5, in index
return render(request, 'index.html')
File "C:\Users\uknow\Desktop\Coding\GoFishFarms\venv\lib\site-packages\django\shortcuts.py", line 19, in render
content = loader.render_to_string(template_name, context, request, using=using)
File "C:\Users\uknow\Desktop\Coding\GoFishFarms\venv\lib\site-packages\django\template\loader.py", line 61, in render_to_string
template = get_template(template_name, using=using)
File "C:\Users\uknow\Desktop\Coding\GoFishFarms\venv\lib\site-packages\django\template\loader.py", line 19, in get_template
raise TemplateDoesNotExist(template_name, chain=chain)
django.template.exceptions.TemplateDoesNotExist: index.html
[25/Jul/2020 13:29:40] "GET / HTTP/1.1" 500 82139
Views.py
from django.shortcuts import render
# Create your views here.
def index(request):
return render(request, 'index.html')
def about(request):
return render(request, 'about.html')
【问题讨论】:
-
你能分享你的
views.py和模板的目录结构吗? -
你去我添加了views.py和目录截图
标签: django django-errors