CodeRocks
CodeRocks

Reputation: 715

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

I have a Django application I want to run locally. I am running on win32 with Python 3.7. I enter the following into Command Prompt on Windows:

$ python manage.py runserver
Django version 2.07, using settings 'web.settings'
Starting development server at http://127.0.0.1:8000
Quit the server with CTRL-BREAK.

The problem comes when I open to localhost:8000/ in my browser. What happens is I'll get this error in Command Prompt:

Traceback (most recent call last):
    File "C:\Program Files\Python37\lib\wsgiref\handlers.py", line 138, in run 
      self.finish_response()
    File "C:\Program Files\Python37\lib\wsgiref\handlers.py", line 180, in finish_response()
      self.write(data)
    File "C:\Programs Files\Python37\lib\wsgiref\handlers.py", line 279, in write
      self.write(data)
    File "C:\Programs Files\Python37\lib\wsgiref\handlers.py", line 453, in _write
      result = self.stdout.write(data)
    File "C:\Programs Files\Python37\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

I am unsure how to get rid of this error.

Upvotes: 7

Views: 9255

Answers (2)

Tormod
Tormod

Reputation: 31

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.

Upvotes: 3

Elthari
Elthari

Reputation: 96

If you're using PostgreSQL on Windows, you may have a code page issue.

>psql -U postgres
psql (9.6)
WARNING: Console code page (850) differs from Windows code page (1252)
     8-bit characters might not work correctly. See psql reference
     page "Notes for Windows users" for details.
Type "help" for help.

postgres=#

Please try setting code page before launching Django.

> cmd.exe /c chcp 1252

Upvotes: 8

Related Questions