更新时间:2023-11-17 23:09:16
您正在使用哪个版本的Django?您是否已设置TEMPLATE_DIRS或DIRS来指示Django在哪里寻找模板?
Which version of Django you are using? Have you setup TEMPLATE_DIRS or DIRS to instruct Django where to look for templates?
发布您的settings.py,urls.py和views.py将有助于首先解决问题.
Posting your settings.py, urls.py and views.py will help to get the issue at first place.
请查看文档获取最新版本的模板设置.
Have a look at the documentation for template settings for latest version.
从settings.py中删除TEMPLATE_DIRS
Remove TEMPLATE_DIRS from settings.py
添加标准Django 1.8.x模板设置
Add standard Django 1.8.x template settings
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(MAIN_DIR, 'templates')],
'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',
],
},
},
]
检查更新注释.