正在全新安装我的流浪盒和我的开发环境,当我尝试运行我的django项目时,我收到以下错误。有什么想法吗?
----------------------------------------
[21/Sep/2013 23:44:03] code 400, message Bad HTTP/0.9 request type ('\x16\x03\x00\x00E\x01\x00\x00A\x03\x00R>u\xa6\x00`b\xceZ\xc8\xe6H2\x85')
----------------------------------------
Exception happened during processing of request from ('10.0.2.2', 60969)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 582, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/home/vagrant/hypnos-venv/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 150, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "/usr/lib/python2.7/SocketServer.py", line 638, in __init__
self.handle()
File "/usr/lib/python2.7/wsgiref/simple_server.py", line 117, in handle
if not self.parse_request(): # An error code has been sent, just exit
File "/usr/lib/python2.7/BaseHTTPServer.py", line 281, in parse_request
"Bad HTTP/0.9 request type (%r)" % command)
File "/usr/lib/python2.7/BaseHTTPServer.py", line 368, in send_error
self.send_response(code, message)
File "/usr/lib/python2.7/BaseHTTPServer.py", line 385, in send_response
self.log_request(code)
File "/usr/lib/python2.7/BaseHTTPServer.py", line 422, in log_request
self.requestline, str(code), str(size))
File "/home/vagrant/hypnos-venv/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 162, in log_message
msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa6 in position 15: ordinal not in range(128)
答案 0 :(得分:31)
您似乎尝试使用http
https
网站
答案 1 :(得分:4)
您是否尝试使用https?
我遇到了同样的问题,最终发现在开发过程中它应该是http(没有s)。 https会对您的请求进行加密,就开发服务器而言,这是一堆乱码。
答案 2 :(得分:3)
从堆栈跟踪看,Django开发服务器尝试记录请求并因请求无效而失败。
事实证明,BaseHTTPServer只记录原始HTTP请求的第一行,因此如果您的浏览器在请求中发送垃圾(谁知道原因),那么开发服务器可能无法尝试记录它。我建议使用开发控制台或Firebug来检查浏览器发送的请求标头。如果是这种情况,那么整个情况更多的是测试环境问题。