python - django 上奇怪的 UnicodeDecodeError

标签 python django http unicode

正在重新安装我的 vagrant box 和我的开发环境,当我尝试运行我的 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)

最佳答案

看起来你试图用 https 访问 http 网站

关于python - django 上奇怪的 UnicodeDecodeError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18940441/

相关文章:

python - 从电脑读取wav文件到arduino mega

精确字符串长度的Python正则表达式

javascript - Django 多个图像无法上传

css - 在 CentOS 上部署我的 Django 应用程序时,样式停止加载

java 11 HttpClient 导致无休止的 SSL 循环

http - Elasticsearch 用于 POST 的 uri 的 http 方法不正确

python - 如何以 json 格式(双引号) pretty-print (人类可读打印)Python dict?

python - 获取 key 错误 : 61 while iterating through the rows

python - 为什么我得到 __init__() takes 1 positional argument but 2 were given?

c# - 将数据发布到 Flex/Flash (mxml) 应用程序