我正在运行Django 2.17,并且从开发服务器收到很多错误,终端在每次向开发服务器的requestx上打印此错误5到6次。
尝试将--verbosity 0添加到runserver命令不会抑制它们。
我想从视图中的函数进行打印,但是我不需要Django的错误。
django IRC频道上的某人告诉我,这很正常...但是看来我的配置不正确。
编辑于:
Traceback (most recent call last):
File "c:\python\Lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "c:\python\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\python\Lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "c:\python\Lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "c:\python\Lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "c:\python\Lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "c:\python\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):
Traceback (most recent call last):
File "c:\python\Lib\socketserver.py", line 647, in process_request_thread
self.finish_request(request, client_address)
File "c:\python\Lib\socketserver.py", line 647, in process_request_thread
self.finish_request(request, client_address)
File "c:\python\Lib\socketserver.py", line 357, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\python\Lib\socketserver.py", line 357, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\python\Lib\socketserver.py", line 717, in __init__
self.handle()
File "c:\python\Lib\socketserver.py", line 717, in __init__
self.handle()
File "C:\Python\virtualenvs\tools\lib\site-packages\django\core\servers\basehttp.py", line 151, in handle
self.handle_one_request()
File "C:\Python\virtualenvs\tools\lib\site-packages\django\core\servers\basehttp.py", line 153, in handle
self.handle_one_request()
File "C:\Python\virtualenvs\tools\lib\site-packages\django\core\servers\basehttp.py", line 176, in handle_one_request
handler.run(self.server.get_app())
File "C:\Python\virtualenvs\tools\lib\site-packages\django\core\servers\basehttp.py", line 176, in handle_one_request
handler.run(self.server.get_app())
File "c:\python\Lib\wsgiref\handlers.py", line 144, in run
self.close()
File "c:\python\Lib\wsgiref\handlers.py", line 144, in run
self.close()
File "c:\python\Lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
File "c:\python\Lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
AttributeError: 'NoneType' object has no attribute 'split'
--------------------------------------------------------------------------------
答案 0 :(得分:0)
看起来您正在尝试拆分一个期望为str
的变量,但是以某种方式改为NoneType
(None
)。