【发布时间】:2018-02-01 19:08:12
【问题描述】:
我没有让 django 1.11 接受新的 base_site.html:
按照文档和一些帖子,我将文件复制到: BASE_DIR/templates/base_site.html 和 BASE_DIR/templates/admin/base_site.html
在 settings.py 中:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'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',
],
'loaders': (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
),
},
},
]
我用模板和模板/管理中的文件尝试过:
>>> print ( os.path.isfile((os.path.join(settings.BASE_DIR, 'templates', 'admin','base_site.html'))) )
True
>>> print ( os.path.isfile((os.path.join(settings.BASE_DIR, 'templates', 'base_site.html'))) )
True
【问题讨论】:
标签: django