我正在尝试解决在Google App Engine上运行的AllAuth / Django 1.7引发的连接错误: 我认为错误可能在Sessions配置中,但我无法识别问题。 本地注册功能正常,但社交登录会引发错误。
编辑:LinkedIn工作正常。
编辑:在本地服务器上;我得到"必须是_socket.socket,而不是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'))
答案 0 :(得分:24)
在做了一些研究之后,似乎AppEngine的问题与我安装的请求版本有关。
我通过pip uninstall requests
(2.5.1),然后pip install requests==2.3
解决了这个问题。