我有一个使用Django + Django Rest Framework + Djoser(基于令牌的身份验证)的Django项目。
该项目运行良好,我可以通过后端获取和发布所需的数据。
但是,在某个时间间隔之后,在某些GET / POST操作期间,一个奇怪的错误随机击中了正在运行的终端,它永远不会导致工作中断,因为终端不会停止运行。
我附上了缩小后的错误屏幕截图,以供参考。
我无法确定错误的位置/要调试的原因。
完整的错误代码,如下所述:
[10/Jun/2020 00:01:19] "GET /media/tracks/Kalimba_FXkucKr.mp3 HTTP/1.1" 200 5382144
Traceback (most recent call last):
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\socketserver.py", line 796, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
[10/Jun/2020 00:01:19] "GET /media/tracks/Kalimba_FXkucKr.mp3 HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 55650)
Traceback (most recent call last):
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\socketserver.py", line 796, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\djangorest\jun4\env\lib\site-packages\django\core\servers\basehttp.py", line 116, in handle_error
super().handle_error()
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "c:\users\dell\desktop\pythonfiles\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 "c:\users\dell\desktop\pythonfiles\Lib\socketserver.py", line 647, in process_request_thread
self.finish_request(request, client_address)
File "c:\users\dell\desktop\pythonfiles\Lib\socketserver.py", line 357, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\users\dell\desktop\pythonfiles\Lib\socketserver.py", line 717, in __init__
self.handle()
File "C:\djangorest\jun4\env\lib\site-packages\django\core\servers\basehttp.py", line 169, in handle
self.handle_one_request()
File "C:\djangorest\jun4\env\lib\site-packages\django\core\servers\basehttp.py", line 194, in handle_one_request
handler.run(self.server.get_app())
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\djangorest\jun4\env\lib\site-packages\django\core\servers\basehttp.py", line 111, in close
super().close()
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\simple_server.py", line 35, in
close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
[10/Jun/2020 00:01:29] "GET /songs/ HTTP/1.1" 200 2211