Django Allauth谷歌错误:SocialApp匹配查询不存在

时间:2017-01-28 14:41:47

标签: python django django-allauth

当我点击django-allauth enter image description here

时,为google设置oauth2时出现错误

可以在下面的错误日志中看到登录页面和社交身份验证设置enter image description here

Traceback:

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  149.                     response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python2.7/dist-packages/allauth/socialaccount/providers/oauth2/views.py" in view
  69.                 return self.dispatch(request, *args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/allauth/socialaccount/providers/oauth2/views.py" in dispatch
  92.         app = provider.get_app(self.request)

File "/usr/local/lib/python2.7/dist-packages/allauth/socialaccount/providers/base.py" in get_app
  52.         return SocialApp.objects.get_current(self.id, request)

File "/usr/local/lib/python2.7/dist-packages/allauth/socialaccount/models.py" in get_current
  38.                 provider=provider)

File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py" in manager_method
  122.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py" in get
  387.                 self.model._meta.object_name

Exception Type: DoesNotExist at /accounts/google/login/
Exception Value: SocialApp matching query does not exist.

更新

设置文件

INSTALLED_APPS = (
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'sorl.thumbnail',
    'django.contrib.sites',

    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    #'allauth.socialaccount.providers.facebook',
    'allauth.socialaccount.providers.google',
    'allauth.socialaccount.providers.linkedin_oauth2',
    #'allauth.socialaccount.providers.paypal',
    'allauth.socialaccount.providers.twitter',

    'django.contrib.admin',

    'django_countries',

    'accounts'
)

和谷歌设置

enter image description here

更新

将社交路径域从子域编辑为主kazichimp.com会在下面创建网址不匹配。可能oauth只适用于主域。

enter image description here

0 个答案:

没有答案