如何解决 Django AllAuth - 'Connection aborted.', error(13, 'Permission denied') 错误?

How do I resolve Django AllAuth - 'Connection aborted.', error(13, 'Permission denied') Error?

我正在尝试解决 AllAuth/Django 1.7 运行 在 Google App Engine 上抛出的连接错误: 我相信错误可能出在会话配置中,但我无法确定问题所在。 本地注册运行正常,但社交登录会引发错误。

编辑: LinkedIn 工作正常。

编辑: 在本地服务器上;输入凭据后我得到 "must be _socket.socket, not socket"。

编辑: AppEngine 服务于 http 或 https 似乎有些歧义;虽然页面是 https,但 URI 被接收为 http。

编辑: 我的每点冻结包:

AppEngine-Email-Backend==1.0
Django==1.7.2
GoogleAppEngineCloudStorageClient==1.9.15.0
MySQL-python==1.2.4b4
bootstrap-admin==0.3.3
django-allauth==0.19.0
django-appengine-toolkit==0.2.1
django-crispy-forms==1.4.0
django-localflavor==1.1
djangoappengine==1.6.3
djangotoolbox==1.6.2
mysqlclient==1.3.4
oauthlib==0.7.2
python-openid==2.2.5
requests==2.5.1
requests-oauthlib==0.4.2
wsgiref==0.1.2

这是我的踪迹:

Request Method: GET
Request URL: https://[app].appspot.com/accounts/google/login/callback/?state=LrL6Pw08bT7r&code=4/Og6R5AWIQX9WFGyF7XsXAVJHfbyBLRbIqxnflCyS2Kg.omD5uljwob8dPm8kb2vw2M1dUc7elQI

Django Version: 1.7.2
Python Version: 2.7.5
Installed Applications:
('bootstrap_admin',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.sites',
 'django.contrib.admindocs',
 'django.contrib.sitemaps',
 'django.contrib.flatpages',
 'appengine_toolkit',
 'djangoappengine',
 'localflavor',
 'crispy_forms',
 'allauth',
 'allauth.account',
 'allauth.socialaccount',
 'allauth.socialaccount.providers.google',
 'supplier',
 'main')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware')


Traceback:
File "/base/data/home/apps/s~[app]/3.381542196672942284/django/core/handlers/base.py" in get_response
  111.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/base/data/home/apps/s~[app]/3.381542196672942284/site_packages/allauth/socialaccount/providers/oauth2/views.py" in view
  54.             return self.dispatch(request, *args, **kwargs)
File "/base/data/home/apps/s~[app]/3.381542196672942284/site_packages/allauth/socialaccount/providers/oauth2/views.py" in dispatch
  109.             access_token = client.get_access_token(request.GET['code'])
File "/base/data/home/apps/s~[app]/3.381542196672942284/site_packages/allauth/socialaccount/providers/oauth2/client.py" in get_access_token
  57.                                 data=data)
File "/base/data/home/apps/s~[app]/3.381542196672942284/site_packages/requests/api.py" in request
  49.     response = session.request(method=method, url=url, **kwargs)
File "/base/data/home/apps/s~[app]/3.381542196672942284/site_packages/requests/sessions.py" in request
  461.         resp = self.send(prep, **send_kwargs)
File "/base/data/home/apps/s~[app]/3.381542196672942284/site_packages/requests/sessions.py" in send
  573.         r = adapter.send(request, **kwargs)
File "/base/data/home/apps/s~[app]/3.381542196672942284/site_packages/requests/adapters.py" in send
  415.             raise ConnectionError(err, request=request)

Exception Type: ConnectionError at /accounts/google/login/callback/
Exception Value: ('Connection aborted.', error(13, 'Permission denied'))

经过一些研究,AppEngine 的问题似乎与我安装的 requests.

版本有关

我通过 pip uninstall requests (2.5.1) 解决了这个问题,然后 pip install requests==2.3

Source