TemplateDoesNotExist at /
home.html
Request Method: GET
Request URL: http://127.0.0.1:5555/
Django Version: 4.2.1
Exception Type: TemplateDoesNotExist
Exception Value:
home.html
Exception Location: C:\Users\soumy\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\template\loader.py, line 19, in get_template
Raised during: geekshows.views.home
Python Executable: C:\Users\soumy\AppData\Local\Programs\Python\Python311\python.exe
Python Version: 3.11.3
Python Path:
['F:\\Django\\geekshows',
'C:\\Users\\soumy\\AppData\\Local\\Programs\\Python\\Python311\\python311.zip',
'C:\\Users\\soumy\\AppData\\Local\\Programs\\Python\\Python311\\DLLs',
'C:\\Users\\soumy\\AppData\\Local\\Programs\\Python\\Python311\\Lib',
'C:\\Users\\soumy\\AppData\\Local\\Programs\\Python\\Python311',
'C:\\Users\\soumy\\AppData\\Roaming\\Python\\Python311\\site-packages',
'C:\\Users\\soumy\\AppData\\Local\\Programs\\Python\\Python311\\Lib\\site-packages']
Server time: Mon, 22 May 2023 13:56:05 +0000
Template-loader postmortem
Django tried loading these templates, in this order:
Using engine django:
django.template.loaders.filesystem.Loader: F:\Django\geekshows\templates\home.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\soumy\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\contrib\admin\templates\home.html (Source does not exist)
django.template.loaders.app_directories.Loader: C:\Users\soumy\AppData\Local\Programs\Python\Python311\Lib\site-packages\django\contrib\auth\templates\home.html (Source does not exist)
django.template.loaders.app_directories.Loader: F:\Django\geekshows\course\templates\home.html (Source does not exist)
django.template.loaders.app_directories.Loader: F:\Django\geekshows\fees\templates\home.html (Source does not exist)
当我运行服务器时,这个错误正在发生。我用的是Django 4.2,怎么用呢?
1条答案
按热度按时间hpcdzsge1#
你似乎有一个视图
home
,呈现home.html
,但home.html
无法找到请注意,你似乎有一个非标准的结构,你的应用程序作为一个视图文件应该在一个应用程序(如
.../geekshows/main/views.py
),但你似乎是在项目根文件夹geekshows。标准结构:
请发布视图并显示放置home.html的文件夹结构以进一步回答您的问题