1

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

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 应用程序设置中的回调 url 是:

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

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

我该如何摆脱这个错误?

4

2 回答 2

2

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

您可能需要修补 allauth 才能使用 GAE 的套接字。您需要阅读 GAE 套接字的限制:

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

于 2013-11-13T18:03:52.580 回答
-3

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

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

于 2013-11-14T03:56:59.380 回答