Django ConnectionAbortedError:[WinError10053]エラー



Django Connectionabortederror



Exception happened during processing of request from ('127.0.0.1', 61328) Traceback (most recent call last): File 'D:Anacondalibwsgirefhandlers.py', line 138, in run self.finish_response() File 'D:Anacondalibwsgirefhandlers.py', line 180, in finish_response self.write(data) File 'D:Anacondalibwsgirefhandlers.py', line 274, in write self.send_headers() File 'D:Anacondalibwsgirefhandlers.py', line 332, in send_headers self.send_preamble() File 'D:Anacondalibwsgirefhandlers.py', line 255, in send_preamble ('Date: %s ' % format_date_time(time.time())).encode('iso-8859-1') File 'D:Anacondalibwsgirefhandlers.py', line 453, in _write result = self.stdout.write(data) File 'D:Anacondalibsocketserver.py', line 775, in write self._sock.sendall(b) ConnectionAbortedError: [WinError 10053] The software in your host has aborted an established connection. During handling of the above exception, another exception occurred: Traceback (most recent call last): File 'D:Anacondalibwsgirefhandlers.py', line 141, in run self.handle_error() File 'D:Anacondalibsite-packagesdjangocoreserversasehttp.py', line 86, in handle_error super().handle_error() File 'D:Anacondalibwsgirefhandlers.py', line 368, in handle_error self.finish_response() File 'D:Anacondalibwsgirefhandlers.py', line 180, in finish_response self.write(data) File 'D:Anacondalibwsgirefhandlers.py', line 274, in write self.send_headers() File 'D:Anacondalibwsgirefhandlers.py', line 331, in send_headers if not self.origin_server or self.client_is_modern(): File 'D:Anacondalibwsgirefhandlers.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:Anacondalibsocketserver.py', line 639, in process_request_thread self.finish_request(request, client_address) File 'D:Anacondalibsocketserver.py', line 361, in finish_request self.RequestHandlerClass(request, client_address, self) File 'D:Anacondalibsocketserver.py', line 696, in __init__ self.handle() File 'D:Anacondalibsite-packagesdjangocoreserversasehttp.py', line 154, in handle handler.run(self.server.get_app()) File 'D:Anacondalibwsgirefhandlers.py', line 144, in run self.close() File 'D:Anacondalibwsgirefsimple_server.py', line 35, in close self.status.split(' ',1)[0], self.bytes_sent AttributeError: 'NoneType' object has no attribute 'split'

ハードワーク このエラーの理由のみが見つかりました:

ajaxのデフォルトは非同期コミットであるため、リクエストがすぐに行われたことがわかる場合がありますが、非同期では突然実行が発生し、問題が発生します。
解決:



ajaxが非同期コミットを行う場合、asyncをfalseに変更します

$.ajax({ type : 'post', url : '**************', data : data, async : false, success : function(data){ alert(data) } })

または



$.ajaxSetup({ async : false })

からの転送: https://blog.csdn.net/qq_38003892/article/details/79902565