[求助] 请求视图时报错 AttributeError: 'NoneType' object has no attribute 'split'

有时候在请求视图的时候报错 环境: win10 1803 + Python 3.6.7 + Django 2.1.3

报错信息:

Exception happened during processing of request from ('127.0.0.1', 64192)
Traceback (most recent call last):
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 138, in run
    self.finish_response()
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 180, in finish_response
    self.write(data)
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 274, in write
    self.send_headers()
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 332, in send_headers
    self.send_preamble()
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 255, in send_preamble
    ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "D:\software\Python 3.6.7\lib\socketserver.py", line 800, in write
    self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] 你的主机中的软件中止了一个已建立的连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 141, in run
    self.handle_error()
  File "D:\software\Python 3.6.7\lib\site-packages\django\core\servers\basehttp.py", line 86, in handle_error
    super().handle_error()
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 368, in handle_error
    self.finish_response()
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 180, in finish_response
    self.write(data)
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 274, in write
    self.send_headers()
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 331, in send_headers
    if not self.origin_server or self.client_is_modern():
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 344, in client_is_modern
    return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\software\Python 3.6.7\lib\socketserver.py", line 651, in process_request_thread
    self.finish_request(request, client_address)
  File "D:\software\Python 3.6.7\lib\socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "D:\software\Python 3.6.7\lib\socketserver.py", line 721, in __init__
    self.handle()
  File "D:\software\Python 3.6.7\lib\site-packages\django\core\servers\basehttp.py", line 154, in handle
    handler.run(self.server.get_app())
  File "D:\software\Python 3.6.7\lib\wsgiref\handlers.py", line 144, in run
    self.close()
  File "D:\software\Python 3.6.7\lib\wsgiref\simple_server.py", line 35, in close
    self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------

评论 0