Django專案執行時出現self.status.split(' ',1)[0], self.bytes_sent,ConnectionAbortedError: [WinError 10053] 你的主機中的軟體中止了一個已建立的連線。
阿新 • • 發佈:2018-11-02
1 [02/Nov/2018 09:46:51] "GET /new_industry/category HTTP/1.1" 200 2891792 2 Traceback (most recent call last): 3 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 138, in run 4 self.finish_response() 5 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 180, in finish_response6 self.write(data) 7 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 274, in write 8 self.send_headers() 9 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 332, in send_headers 10 self.send_preamble() 11 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 255, in send_preamble 12 ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') 13 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 453, in _write 14 result = self.stdout.write(data) 15 File "C:\Program Files\Python36\lib\socketserver.py", line 775, inwrite 16 self._sock.sendall(b) 17 ConnectionAbortedError: [WinError 10053] 你的主機中的軟體中止了一個已建立的連線。 18 [02/Nov/2018 09:46:51] "GET /new_industry/category HTTP/1.1" 500 59 19 ---------------------------------------- 20 Exception happened during processing of request from ('127.0.0.1', 54843) 21 Traceback (most recent call last): 22 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 138, in run 23 self.finish_response() 24 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 180, in finish_response 25 self.write(data) 26 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 274, in write 27 self.send_headers() 28 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 332, in send_headers 29 self.send_preamble() 30 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 255, in send_preamble 31 ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') 32 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 453, in _write 33 result = self.stdout.write(data) 34 File "C:\Program Files\Python36\lib\socketserver.py", line 775, in write 35 self._sock.sendall(b) 36 ConnectionAbortedError: [WinError 10053] 你的主機中的軟體中止了一個已建立的連線。 37 38 During handling of the above exception, another exception occurred: 39 40 Traceback (most recent call last): 41 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 141, in run 42 self.handle_error() 43 File "C:\Program Files\Python36\lib\site-packages\django\core\servers\basehttp.py", line 86, in handle_error 44 super().handle_error() 45 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 368, in handle_error 46 self.finish_response() 47 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 180, in finish_response 48 self.write(data) 49 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 274, in write 50 self.send_headers() 51 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 331, in send_headers 52 if not self.origin_server or self.client_is_modern(): 53 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 344, in client_is_modern 54 return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9' 55 TypeError: 'NoneType' object is not subscriptable 56 57 During handling of the above exception, another exception occurred: 58 59 Traceback (most recent call last): 60 File "C:\Program Files\Python36\lib\socketserver.py", line 639, in process_request_thread 61 self.finish_request(request, client_address) 62 File "C:\Program Files\Python36\lib\socketserver.py", line 361, in finish_request 63 self.RequestHandlerClass(request, client_address, self) 64 File "C:\Program Files\Python36\lib\socketserver.py", line 696, in __init__ 65 self.handle() 66 File "C:\Program Files\Python36\lib\site-packages\django\core\servers\basehttp.py", line 154, in handle 67 handler.run(self.server.get_app()) 68 File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 144, in run 69 self.close() 70 File "C:\Program Files\Python36\lib\wsgiref\simple_server.py", line 35, in close 71 self.status.split(' ',1)[0], self.bytes_sent 72 AttributeError: 'NoneType' object has no attribute 'split'
此原因是因為,多次重新整理,ajax多次進行請求,而且請求資料過大導致
ajax預設非同步請求,改成同步可以解決問題
ajax 加入一行 async : false,