我目前正在尝试使用我的学校的LDAP和使用Django构建的网站。但是我遇到了一个我无法解决的错误。
当我使用学校的网络时,LDAP登录在localhost上完美运行。但是当我使用校外网络时,登录不起作用,即使我第一次运行manage.py时创建的管理员登录也不起作用。
每次尝试登录时终端显示都会出现以下错误:
Traceback (most recent call last):
File "/Users/Me/anaconda/lib/python2.7/wsgiref/handlers.py", line 86, in run
self.finish_response()
File "/Users/Me/anaconda/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response
self.write(data)
File "/Users/Me/anaconda/lib/python2.7/wsgiref/handlers.py", line 212, in write
self.send_headers()
File "/Users/Me/anaconda/lib/python2.7/wsgiref/handlers.py", line 270, in send_headers
self.send_preamble()
File "/Users/Me/anaconda/lib/python2.7/wsgiref/handlers.py", line 194, in send_preamble
'Date: %s\r\n' % format_date_time(time.time())
File "/Users/Me/anaconda/lib/python2.7/socket.py", line 324, in write
self.flush()
File "/Users/Me/anaconda/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
[28/Jan/2014 11:18:43] "POST /admin/ HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 60538)
Traceback (most recent call last):
File "/Users/Me/anaconda/lib/python2.7/SocketServer.py", line 593, in process_request_thread
self.finish_request(request, client_address)
File "/Users/Me/anaconda/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Users/Me/anaconda/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 150, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "/Users/Me/anaconda/lib/python2.7/SocketServer.py", line 651, in __init__
self.finish()
File "/Users/Me/anaconda/lib/python2.7/SocketServer.py", line 710, in finish
self.wfile.close()
File "/Users/Me/anaconda/lib/python2.7/socket.py", line 279, in close
self.flush()
File "/Users/Me/anaconda/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------
非常感谢你的帮助!
答案 0 :(得分:1)
这是Django devserver的一个问题(您使用它运行您的网站,对于生产网站根本不建议使用它)。
有关详细信息,请参阅this ticket:
根据许多消息来源,'Broken Pipe'是一个普通的浏览器怪癖。例如,浏览器从套接字读取,然后决定它正在阅读的图像显然没有改变。浏览器现在(强制)关闭连接,因为它不需要更多数据。这个套接字的另一端(python runserver)现在引发一个套接字异常,告诉程序客户端“破坏套接字管道”。
简短回答是:忽略此错误,因为它是已知错误,无法修复。
还有this SO thread谈论这个问题。