Unicodedecodeerror with runserver

后端 未结 3 907
醉酒成梦
醉酒成梦 2020-11-28 15:07

After setting up all what django requires, I tried the runserver command and I caught an error:

UnicodeDecodeError

相关标签:
3条回答
  • 2020-11-28 15:20

    This sounds like this Python issue. If your computer name has non-ASCII characters this will fail. You may:

    1. Issue the runserver command with explicit host and port: python manage.py runserver 127.0.0.1:8000
    2. Change your computer name to a string that only contains ASCII characters.
    0 讨论(0)
  • 2020-11-28 15:21

    I hit this issue on python 3.4 with the following situation :

    • Server did have an ascii-only hostname (like host1)
    • The /etc/hosts file did not contain an entry for my hostname
    • There was no available DNS resolver (offline computer)

    After adding the following entry to the /etc/hosts file, no further UnicodeDecodeError exceptions were thrown.

    127.0.0.1 localhost host1
    
    0 讨论(0)
  • 2020-11-28 15:27

    I just had this issue because I accidentally visited the site with https instead of http. Switching back to http fixed it.

    0 讨论(0)
提交回复
热议问题