python – UnicodeDecodeError when starting a new Django project on Windows


I am creating a new Django project using PyCharm. I don't change anything. When starting the project, it knocks out an error:

"C:\Program Files (x86)\JetBrains\PyCharm 5.0.3\bin\runnerw.exe"
C:\Python34\python.exe E:/Projects/Proj_test/ runserver 8000

Performing system checks...

System check identified no issues (0 silenced).

You have unapplied migrations; your app may not work properly until
they are applied. Run 'python migrate' to apply them.
January 23, 2016 - 12:55:37
Django version 1.9.1, using settings 'Proj_test.settings'
Starting development server at
Quit the server with CTRL-BREAK.

Unhandled exception in thread started by <function check_errors.<locals>.wrapper
at 0x036E9078>

Traceback (most recent call last):
  File "C:\Python34\lib\http\", line 138, in server_bind
    self.server_name = socket.getfqdn(host)
  File "C:\Python34\lib\", line 467, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc2 in position 0: invalid continuation byte

The situation is similar when using Visual Studio. Changing the Python version doesn't solve it. I am using Windows 7.

Tell me how you can solve this error.


This is a bug in Python 3.4+: Windows: socket.gethostbyaddr (name) fails for non-ASCII hostname .

As a workaround, try passing the hostname as an ip address (e.g. python runserver ) or rename the host so that there are no non-ASCII characters in the name.

Scroll to Top