1. 程式人生 > 其它 >Django: ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

Django: ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine

========================================

Traceback (most recent call last):
File "D:\Program Files\python_3_6_4\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "D:\Program Files\python_3_6_4\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "D:\Program Files\python_3_6_4\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "D:\Program Files\python_3_6_4\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "D:\Program Files\python_3_6_4\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "D:\Program Files\python_3_6_4\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "D:\Program Files\python_3_6_4\lib\socketserver.py", line 775, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
========================================

You have set up a query and a db that are using the same language. However while the DB used a code page with 850 possible characters, your session had 1252 possible characters. When the two tries to communicate there are symbols that cannot match up between the query and the DB.

cmd.exe /c chcp 1252 -> sets the query language to 1252 possible characters == db(1252 possible characters), which resolves the issue.

Please try setting code page before launching Django.

執行以下命令即可:

cmd.exe /c chcp 1252

REF:

https://stackoverflow.com/questions/54465300/django-connectionabortederror-winerror-10053-an-established-connection-was-a