Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
升级Django和allauth,并在/accounts/profile处返回KeyError/_Django_Upgrade_Init_Django Allauth_Keyerror - Fatal编程技术网

升级Django和allauth,并在/accounts/profile处返回KeyError/

升级Django和allauth,并在/accounts/profile处返回KeyError/,django,upgrade,init,django-allauth,keyerror,Django,Upgrade,Init,Django Allauth,Keyerror,我从Django 1.7.1升级到1.9,同时升级了allauth。升级后,我不得不修复许多bug,但这次我被卡住了。除了提供程序\u登录\u url外,一切正常。。如果我从模板中删除url,它会正常呈现,但我无法链接到url 错误: KeyError at /accounts/profile/ Django Version: 1.9.2 Exception Type: KeyError Exception Value: 'facebook' /allauth/socialaccoun

我从Django 1.7.1升级到1.9,同时升级了allauth。升级后,我不得不修复许多bug,但这次我被卡住了。除了提供程序\u登录\u url外,一切正常。。如果我从模板中删除url,它会正常呈现,但我无法链接到url

错误:

KeyError at /accounts/profile/

Django Version: 1.9.2
Exception Type: KeyError
Exception Value:    
'facebook'
/allauth/socialaccount/providers/__init__.py in by_id, line 20

Error during template rendering
allauth/templates/account/profile.html, error at line 68

68 .. <a href="{% provider_login_url "facebook" process="connect" %}" class="edit_profile_link">Connect this account with my Facebook account</a>

在配置文件模板中,确保

{% load socialaccount %}
INSTALLED_APPS = (
  'allauth',
  'allauth.account',
  'allauth.socialaccount',
  'allauth.socialaccount.providers.facebook',
  ...
)
在“设置”中,确保

{% load socialaccount %}
INSTALLED_APPS = (
  'allauth',
  'allauth.account',
  'allauth.socialaccount',
  'allauth.socialaccount.providers.facebook',
  ...
)
“facebook”的关键错误可能是由于缺少上面的facebook提供商

由于您从1.7升级了应用程序,请确保在设置中更改您的请求上下文处理器

TEMPLATE_CONTEXT_PROCESSORS = (
    ...
    # Required by `allauth` template tags
    'django.core.context_processors.request',
    ...
)


您可能希望尝试迭代
{%get\u providers as socialaccount\u providers%}
以查看facebook是否是一个选项。如果我使用{%get\u providers as socialaccount\u providers%},则会出现以下错误:第6行的块标记无效:“get\u providers”。您是否忘记注册或加载此标记?您的“account/profile.html”中有什么内容?