gaierror at / accounts / social / signup / - Django allauth twitter注册

时间:2013-11-13 06:12:58

标签: django google-app-engine twitter django-allauth

我在Google App Engine中托管了django website。我正在使用allauth通过Twitter登录我的应用程序。当用户尝试注册该应用时,会将其重定向到Twitter进行授权,授权后,会将其重定向到http://ofon123.appspot.com/accounts/social/signup/,并要求在表单中提供用户名(已填充)和电子邮件(空白)。在提交表单时,我在同一个网址中收到此错误:

gaierror at /accounts/social/signup/
[Errno 8] nodename nor servname provided, or not known
Request Method: POST
Request URL:    http://ofon123.appspot.com/accounts/social/signup/
Django Version: 1.4.3
Exception Type: gaierror
Exception Value:    
[Errno 8] nodename nor servname provided, or not known
Exception Location: /base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/remote_socket/_remote_socket.py in _ResolveName, line 231
Python Executable:  /base/data/home/runtimes/python27/python27_dist/python
Python Version: 2.7.5
Python Path:    
['/base/data/home/apps/s~ofon123/1.371600740837279431/apps',
 '/base/data/home/apps/s~ofon123/1.371600740837279431',
 '/base/data/home/apps/s~ofon123/1.371600740837279431',
 '/base/data/home/runtimes/python27/python27_dist/lib/python27.zip',
 '/base/data/home/runtimes/python27/python27_dist/lib/python2.7',
 '/base/data/home/runtimes/python27/python27_dist/lib/python2.7/plat-linux2',
 '/base/data/home/runtimes/python27/python27_dist/lib/python2.7/lib-tk',
 '/base/data/home/runtimes/python27/python27_dist/lib/python2.7/lib-old',
 '/base/data/home/runtimes/python27/python27_dist/lib/python2.7/lib-dynload',
 '/base/data/home/runtimes/python27/python27_dist/lib/python2.7/site-packages',
 '/base/data/home/runtimes/python27/python27_lib/versions/1',
 '/base/data/home/runtimes/python27/python27_lib/versions/third_party/MySQLdb-1.2.4b4',
 '/base/data/home/runtimes/python27/python27_lib/versions/third_party/PIL-1.1.7',
 '/base/data/home/runtimes/python27/python27_lib/versions/third_party/PIL-1.1.7/PIL',
 '/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.4',
 '/base/data/home/runtimes/python27/python27_lib/versions/third_party/protorpc-1.0',
 '/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3',
 '/base/data/home/runtimes/python27/python27_lib/versions/third_party/webob-1.1.1',
 '/base/data/home/runtimes/python27/python27_lib/versions/third_party/yaml-3.10']
Server time:    Wed, 13 Nov 2013 05:55:30 +0000

我在Twitter应用程序设置中的回调网址是:

Callback URL: http://ofon123.appspot.com

尽管出现错误,用户实际上已注册了应用程序(我可以在django管理的社交帐户中看到它)。

如何摆脱此错误?

2 个答案:

答案 0 :(得分:2)

从错误消息中看起来allauth正在使用套接字api连接到某处,但套接字无法连接。您可能希望有一个异常处理程序捕获异常并转储堆栈跟踪(使用logging.exception())来隔离发生的位置。

您可能需要修补allauth以使用GAE的套接字。您需要了解GAE套接字的限制:

https://developers.google.com/appengine/docs/python/sockets/

答案 1 :(得分:-2)

终于以这种方式解决了......

我允许将验证电子邮件发送给新用户。这是由settings.py ACCOUNT_EMAIL_VERIFICATION = "optional"中的行启用的。这是allauth使用套接字api连接到smtp但无法连接的地方。首先,我认为将其设置为可选,allauth不会尝试在项目的第一阶段发送我想要的电子邮件。但我发现我必须设置ACCOUNT_EMAIL_VERIFICATION = "none"以禁用allauth发送验证邮件。这解决了我目前的问题。