问题是升级到Django 1.8后,在settings.py中没有按要求设置模板设置。我还不清楚为什么它可以在使用Django服务器的PC上运行。
从allauth文档中,我将其粘贴到设置文件中:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
# Already defined Django-related contexts here
# `allauth` needs this from django
'django.template.context_processors.request',
],
},
},
]
并将我的旧TEMPLATE_DIRS
设置的内容复制到TEMPLATES的DIRS定义中。最终结果如下所示:
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
# Already defined Django-related contexts here
# `allauth` needs this from django
'django.template.context_processors.request',
],
},
},
]
根据最近的allauth更新的文档,context_processors
现在需要在TEMPLATES设置中指定而不是在TEMPLATE_CONTEXT_PROCESSORS
设置中。