玩蛇网提供最新Python编程技术信息以及Python资源下载!

Django服务器报错virtualenv服务器不能运行UnicodeDecodeError

测试django模板cookiecutter时候,调整了下设置,结果某一次运行runserver之后,出现了下列报错.结果可怕的事情发生了:本机的所有项目(所属virtualenv不同),runserver本来能跑通的,现在都能成功Starting development server at http://127.0.0.1:8000/,但是只要用浏览器(测试了chrome和ie)一访问,立刻全部出现.

无法显示此网页

重新加载隐藏详细信息 网址为 https://127.0.0.1:8000/ 的网页可能暂时无法连接,或者它已永久性地移动到了新网址。
错误代码:ERR_CONNECTION_CLOSED

命令行报错如下:

Performing system checks...

System check identified no issues (0 silenced).
November 26, 2014 - 10:31:32
Django version 1.7.1, using settings 'twoscoops.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
----------------------------------------
[26/Nov/2014 10:31:37] code 400, message Bad HTTP/0.9 request type ('\x16\x03\x01\x00\xb3\x01\x00\x00\xaf\x03\x03{\xab\xa4\x0e')
Exception happened during processing of request from ('127.0.0.1', 49893)
Traceback (most recent call last):
----------------------------------------
  File "C:\Python27\Lib\SocketServer.py", line 595, in process_request_thread
Exception happened during processing of request from ('127.0.0.1', 49894)
[26/Nov/2014 10:31:37] code 400, message Bad request syntax ('\x16\x03\x01\x00\xb3\x01\x00\x00\xaf\x03\x03A\x12\x15\xd3\xf8\x0e\xfb\xbd\xf77h\xac)J\xd7\xacv\x1aD\xb3N\xb8\xc5\xd3\xa3b\x97\xfd}F\xfb\x89\x00\x00(\xcc\x14\xcc\x13\xc0+\xc0/\x00\x9e\xc0')
Traceback (most recent call last):
  File "C:\Python27\Lib\SocketServer.py", line 595, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Python27\Lib\SocketServer.py", line 334, in finish_request
    self.finish_request(request, client_address)
  File "C:\Python27\Lib\SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 129, in __init__
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Python27\Lib\SocketServer.py", line 651, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Python27\Lib\SocketServer.py", line 651, in __init__
    self.handle()
  File "C:\Python27\Lib\wsgiref\simple_server.py", line 117, in handle
    self.handle()
  File "C:\Python27\Lib\wsgiref\simple_server.py", line 117, in handle
    if not self.parse_request(): # An error code has been sent, just exit
    if not self.parse_request(): # An error code has been sent, just exit
  File "C:\Python27\Lib\BaseHTTPServer.py", line 281, in parse_request
  File "C:\Python27\Lib\BaseHTTPServer.py", line 286, in parse_request
----------------------------------------
----------------------------------------
    self.send_error(400, "Bad request syntax (%r)" % requestline)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 368, in send_error
    "Bad HTTP/0.9 request type (%r)" % command)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 368, in send_error
    self.send_response(code, message)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 385, in send_response
    self.send_response(code, message)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 385, in send_response
    self.log_request(code)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 422, in log_request
    self.log_request(code)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 422, in log_request
    self.requestline, str(code), str(size))
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 136, in log_message
    self.requestline, str(code), str(size))
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 136, in log_message
    msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb3 in position 5: ordinal not in range(128)
    msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb3 in position 5: ordinal not in range(128)
[26/Nov/2014 10:31:37] code 400, message Bad HTTP/0.9 request type ('\x16\x03\x01\x00\x93\x01\x00\x00\x8f\x03\x02o\xd6vw#`\xb84\xd1}J&\xb3\xf7\xde\xa8)')
Traceback (most recent call last):
  File "C:\Python27\Lib\SocketServer.py", line 595, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Python27\Lib\SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Python27\Lib\SocketServer.py", line 651, in __init__
    self.handle()
  File "C:\Python27\Lib\wsgiref\simple_server.py", line 117, in handle
    if not self.parse_request(): # An error code has been sent, just exit
  File "C:\Python27\Lib\BaseHTTPServer.py", line 281, in parse_request
    "Bad HTTP/0.9 request type (%r)" % command)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 368, in send_error
    self.send_response(code, message)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 385, in send_response
    self.log_request(code)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 422, in log_request
    self.requestline, str(code), str(size))
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 136, in log_message
    msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position 5: ordinal not in range(128)
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49896)
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49897)
----------------------------------------
[26/Nov/2014 10:31:37] code 400, message Bad request syntax ('\x16\x03\x01\x00\x93\x01\x00\x00\x8f\x03\x01\x082\x9a\x7f\xf7\\$c\xd8\xceC')
Traceback (most recent call last):
  File "C:\Python27\Lib\SocketServer.py", line 595, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Python27\Lib\SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Python27\Lib\SocketServer.py", line 651, in __init__
    self.handle()
  File "C:\Python27\Lib\wsgiref\simple_server.py", line 117, in handle
    if not self.parse_request(): # An error code has been sent, just exit
  File "C:\Python27\Lib\BaseHTTPServer.py", line 286, in parse_request
    self.send_error(400, "Bad request syntax (%r)" % requestline)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 368, in send_error
    self.send_response(code, message)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 385, in send_response
    self.log_request(code)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 422, in log_request
    self.requestline, str(code), str(size))
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 136, in log_message
    msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position 5: ordinal not in range(128)
[26/Nov/2014 10:31:37] code 400, message Bad request syntax ('\x16\x03\x01\x00\xb3\x01\x00\x00\xaf\x03\x03\xc9\x07\xb7\xe7\x91\x8f\xb3\xb0\x15\x83XI\xc7\xe7E!-\x1c\x9b\x04V\x07.%\xd2Vc0/Z\x88j\x00\x00(\xcc\x14\xcc\x13\xc0+\xc0/\x00\x9e\xc0')
Traceback (most recent call last):
  File "C:\Python27\Lib\SocketServer.py", line 595, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Python27\Lib\SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Python27\Lib\SocketServer.py", line 651, in __init__
    self.handle()
  File "C:\Python27\Lib\wsgiref\simple_server.py", line 117, in handle
    if not self.parse_request(): # An error code has been sent, just exit
  File "C:\Python27\Lib\BaseHTTPServer.py", line 286, in parse_request
    self.send_error(400, "Bad request syntax (%r)" % requestline)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 368, in send_error
    self.send_response(code, message)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 385, in send_response
    self.log_request(code)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 422, in log_request
    self.requestline, str(code), str(size))
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 136, in log_message
    msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb3 in position 5: ordinal not in range(128)
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49898)
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49899)
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49900)
----------------------------------------
[26/Nov/2014 10:31:37] code 400, message Bad request syntax ('\x16\x03\x01\x00\x93\x01\x00\x00\x8f\x03\x02B\xbe\x9a\xdcb\xd88\x14\x00^\x88\xbd\xa4\xbf\xee`\x13\xb1T2\x8c\xa9f\x04}\x92\x1e_=<\x04\xbe\x00\x00\x1e\xc0')
Traceback (most recent call last):
  File "C:\Python27\Lib\SocketServer.py", line 595, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Python27\Lib\SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Python27\Lib\SocketServer.py", line 651, in __init__
    self.handle()
  File "C:\Python27\Lib\wsgiref\simple_server.py", line 117, in handle
    if not self.parse_request(): # An error code has been sent, just exit
  File "C:\Python27\Lib\BaseHTTPServer.py", line 286, in parse_request
    self.send_error(400, "Bad request syntax (%r)" % requestline)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 368, in send_error
    self.send_response(code, message)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 385, in send_response
    self.log_request(code)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 422, in log_request
    self.requestline, str(code), str(size))
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 136, in log_message
    msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position 5: ordinal not in range(128)
[26/Nov/2014 10:31:37] code 400, message Bad HTTP/0.9 request type ('\x16\x03\x01\x00\x93\x01\x00\x00\x8f\x03\x01\xd7\x0f\x07\x88\xe7k\x1fp=\xa5I\x1a\x00\xab\xd8\x914')
Traceback (most recent call last):
  File "C:\Python27\Lib\SocketServer.py", line 595, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Python27\Lib\SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Python27\Lib\SocketServer.py", line 651, in __init__
    self.handle()
  File "C:\Python27\Lib\wsgiref\simple_server.py", line 117, in handle
    if not self.parse_request(): # An error code has been sent, just exit
  File "C:\Python27\Lib\BaseHTTPServer.py", line 281, in parse_request
    "Bad HTTP/0.9 request type (%r)" % command)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 368, in send_error
    self.send_response(code, message)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 385, in send_response
    self.log_request(code)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 422, in log_request
    self.requestline, str(code), str(size))
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 136, in log_message
    msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position 5: ordinal not in range(128)
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49907)
----------------------------------------
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49908)
----------------------------------------
[26/Nov/2014 10:31:42] code 400, message Bad request syntax ('\x16\x03\x01\x00\xb3\x01\x00\x00\xaf\x03\x03\x91\x1f\xbaE\x1e\x12~\xe8\x9b\xa8\xc5\x04\xd7=\xef\x1b\xe7\xb1\xb8\xa5\xde\x0f\xcd\x1f*\\\xe7\xa0\xff\x82\xd7c\x00\x00(\xcc\x14\xcc\x13\xc0+\xc0/\x00\x9e\xc0')
Traceback (most recent call last):
  File "C:\Python27\Lib\SocketServer.py", line 595, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Python27\Lib\SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Python27\Lib\SocketServer.py", line 651, in __init__
    self.handle()
  File "C:\Python27\Lib\wsgiref\simple_server.py", line 117, in handle
    if not self.parse_request(): # An error code has been sent, just exit
  File "C:\Python27\Lib\BaseHTTPServer.py", line 286, in parse_request
    self.send_error(400, "Bad request syntax (%r)" % requestline)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 368, in send_error
    self.send_response(code, message)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 385, in send_response
    self.log_request(code)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 422, in log_request
    self.requestline, str(code), str(size))
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 136, in log_message
    msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xb3 in position 5: ordinal not in range(128)
[26/Nov/2014 10:31:42] code 400, message Bad request syntax ('\x16\x03\x01\x00\x93\x01\x00\x00\x8f\x03\x02\x9f\xe6\x12X\xe1t\xde\xed&.\x8d%\x8a\xc8m\xae35\xfc\x1b\xfa_\x9d\xd3\x96\x12\xf5\xd3\xb2\xb3\xab\xaf\x00\x00\x1e\xc0')
Traceback (most recent call last):
  File "C:\Python27\Lib\SocketServer.py", line 595, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Python27\Lib\SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Python27\Lib\SocketServer.py", line 651, in __init__
    self.handle()
  File "C:\Python27\Lib\wsgiref\simple_server.py", line 117, in handle
    if not self.parse_request(): # An error code has been sent, just exit
  File "C:\Python27\Lib\BaseHTTPServer.py", line 286, in parse_request
    self.send_error(400, "Bad request syntax (%r)" % requestline)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 368, in send_error
    self.send_response(code, message)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 385, in send_response
    self.log_request(code)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 422, in log_request
    self.requestline, str(code), str(size))
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 136, in log_message
    msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position 5: ordinal not in range(128)
[26/Nov/2014 10:31:42] code 400, message Bad HTTP/0.9 request type ('\x16\x03\x01\x00\x93\x01\x00\x00\x8f\x03\x01\xee<\x1f\x96\xd3\x94\xf3/\xf6\xf8\xbd\x9b\x8b\x92')
Traceback (most recent call last):
  File "C:\Python27\Lib\SocketServer.py", line 595, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Python27\Lib\SocketServer.py", line 334, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 129, in __init__
    super(WSGIRequestHandler, self).__init__(*args, **kwargs)
  File "C:\Python27\Lib\SocketServer.py", line 651, in __init__
    self.handle()
  File "C:\Python27\Lib\wsgiref\simple_server.py", line 117, in handle
    if not self.parse_request(): # An error code has been sent, just exit
  File "C:\Python27\Lib\BaseHTTPServer.py", line 281, in parse_request
    "Bad HTTP/0.9 request type (%r)" % command)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 368, in send_error
    self.send_response(code, message)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 385, in send_response
    self.log_request(code)
  File "C:\Python27\Lib\BaseHTTPServer.py", line 422, in log_request
    self.requestline, str(code), str(size))
  File "C:\Users\wutong\Envs\2s\lib\site-packages\django\core\servers\basehttp.py", line 136, in log_message
    msg = "[%s] %s\n" % (self.log_date_time_string(), format % args)
UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position 5: ordinal not in range(128)
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49909)
----------------------------------------

注意你后来打开的网址是https开头的,换回http的就行了

玩蛇网文章,转载请注明出处和文章网址:https://www.iplaypy.com/wenda/wd19202.html

相关文章 Recommend

玩蛇网Python互助QQ群,欢迎加入-->: 106381465 玩蛇网Python新手群
修订日期:2017年05月22日 - 08时53分41秒 发布自玩蛇网

您现在的位置: 玩蛇网首页 > Python问题解答 > 正文内容
我要分享到:

必知PYTHON教程 Must Know PYTHON Tutorials

必知PYTHON模块 Must Know PYTHON Modules