有个问题一直困扰着我:网上查到的资料中,都提到要在settings.py 中配置templates文件夹路径,才能正常找到模板,但我的项目并没有配置,也能够正常工作,这是为什么呢??
网上的资料:
https://www.cnblogs.com/alan-babyblog/p/5828026.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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'
,