<p>问题是,在升级到Django 1.8之后,在settings.py中没有根据需要设置模板。我不清楚为什么它在我的电脑上使用Django服务器。</p>
<p>从allauth文档中,我将其粘贴到我的设置文件中:</p>
<pre><code>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',
],
},
},
]
</code></pre>
<p>并将我以前的<code>TEMPLATE_DIRS</code>设置的内容复制到模板的DIRS定义中。最终结果如下:</p>
<pre><code>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',
],
},
},
]
</code></pre>
<p>根据最近allauth更新的文档,现在需要在模板设置中指定<code>context_processors</code>,而不是<code>TEMPLATE_CONTEXT_PROCESSORS</code>设置。</p>
<p>感谢<a href="https://stackoverflow.com/users/1971587/joey-wilhelm">Joey Wilhelm</a>在这个问题上指引我正确的方向。</p>