【发布时间】:2016-12-23 11:09:05
【问题描述】:
我的 django 10 项目中有以下目录结构:
/my-project/ # project dir
+app1
+templates
+admin
base.html
404.html
500.html
我的模板属性在设置中如下所示:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
'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',
'common.context_processors.site_info',
],
},
},
]
我的自定义 base.html 显示在我的本地计算机上。当我将它上传到我的生产服务器时,它不再覆盖并使用项目文件夹中的 base.html 文件。
我已经改变了建议的应用程序here 的顺序,并尝试打印模板属性的 dirs 元素,该元素打印“templates/”,如here。
有谁知道我怎样才能让它在我的生产环境中工作?
【问题讨论】:
标签: python django django-templates django-admin django-settings