• 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

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

    因为ajax默认是异步提交,可是有时候我们会发现,本来要求请求马上出现,可是异步会导致后面突然再执行,这样就出问题了。

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

    self._sock.sendall(b) ConnectionAbortedError: [WinError 10053] 您的主机中的软件中止了一个已建立的连接。

    解决方法(可行)

    找到python/Lib/socketserver.py文件,修改SocketWriter类的write方法,具体如下:

    def write(self, b):
        try:
            self._sock.sendall(b)
        except Exception as e:
            self._sock.close()
        with memoryview(b) as view:
            return view.nbytes

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

    REF:

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

    https://blog.csdn.net/qq_38003892/article/details/79902565

    https://blog.csdn.net/weixin_43917239/article/details/93967462

  • 相关阅读:
    codeforces 1065F Up and Down the Tree
    初探莫比乌斯反演
    IOI2008 island
    miller——rabin判断素数
    NOIP2018游记
    NP是什么意思?
    word2016如何英汉互译
    2.1数字图像化
    Windows程序内部运行机制
    2.2图像灰度直方图
  • 原文地址:https://www.cnblogs.com/emanlee/p/15862999.html
Copyright © 2020-2023  润新知