还在学习Django的基础知识,我有点挣扎。现在我正在为我的网站创建一个主页。项目名称为“用餐计划”,应用程序为“用餐计划”。在
用餐计划员/网址.py包含以下代码:from django.conf.urls import include, url
from django.contrib import admin
from django.urls import path
urlpatterns = [
# url(r'', include('meal_plans.urls', namespace='meal_plans'))
path('', include('meal_plans.urls', namespace='meal_plans'))
]
用餐计划/网址.py包含以下代码:
^{pr2}$
还有用餐计划/视图.py包含以下代码:from django.shortcuts import render
# Create your views here.
def index(request):
"""Homepage"""
return render(request, 'main\index.html')
我得到的错误是TemplateDoesNotExist at /
main\index.html
Template-loader postmortem
Django tried loading these templates, in this order:
Using engine django:
django.template.loaders.app_directories.Loader: ...\meal_planner\mp\lib\site-packages\django\contrib\admin\templates\main\index.html (Source does not exist)
django.template.loaders.app_directories.Loader: ...\meal_planner\mp\lib\site-packages\django\contrib\auth\templates\main\index.html (Source does not exist)
我试着研究如何做这件事,但就是做不好。感谢任何帮助。在