1

I just tries to start django project on win7(x64), but i faced with following issue:

$ python manage.py runserver
Performing system checks...

System check identified no issues (0 silenced).
March 24, 2018 - 14:24:08
Django version 1.11.3, using settings 'superlists.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Unhandled exception in thread started by <function check_errors.<locals>.wrapper
 at 0x035BD978>
Traceback (most recent call last):
  File "C:\Users\alesya\.virtualenvs\superlists\lib\site-packages\django\utils\a
utoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\alesya\.virtualenvs\superlists\lib\site-packages\django\core\ma
nagement\commands\runserver.py", line 149, in inner_run
    ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
  File "C:\Users\alesya\.virtualenvs\superlists\lib\site-packages\django\core\se
rvers\basehttp.py", line 164, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "C:\Users\alesya\.virtualenvs\superlists\lib\site-packages\django\core\se
rvers\basehttp.py", line 74, in __init__
    super(WSGIServer, self).__init__(*args, **kwargs)
  File "c:\users\alesya\appdata\local\programs\python\python36-32\Lib\socketserv
er.py", line 453, in __init__
    self.server_bind()
  File "c:\users\alesya\appdata\local\programs\python\python36-32\Lib\wsgiref\si
mple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "c:\users\alesya\appdata\local\programs\python\python36-32\Lib\http\serve
r.py", line 138, in server_bind
    self.server_name = socket.getfqdn(host)
  File "c:\users\alesya\appdata\local\programs\python\python36-32\Lib\socket.py"
, line 673, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 14: invalid
 start byte

My computer has an ASCII name, so I even not realized, what happens. Did all these things on another win7 and everything was ok. Maybe someone can help with?

UPD. My problem was due to the changed 'hosts' file - there are a lot of disabled addresses. Thanks all for the answers.

Alice
  • 11
  • 3
  • There is a warning in trace "You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run 'python manage.py migrate' to apply them.". Try to run 'python manage.py migrate' – Vigen Mar 24 '18 at 11:16
  • thank u for answer, but it didn't help. I've edit my question after migration. – Alice Mar 24 '18 at 11:25
  • Your error is "UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbb in position 14: invalid start byte". look to this https://stackoverflow.com/questions/22216076/unicodedecodeerror-utf8-codec-cant-decode-byte-0xa5-in-position-0-invalid-s – Vigen Mar 24 '18 at 13:02
  • Perhaps there are other names mapped to `127.0.0.1` in your `hosts` file that do not contain ASCII characters. Could you post your `C:\Windows\System32\drivers\etc\hosts` file and also the name of your computer. – Will Keeling Mar 24 '18 at 14:14
  • Will, thank you.I have modified host file, and disable a lot of ms addresses. So I think this is a reason of my problem. Name of computer is buk. – Alice Mar 25 '18 at 16:03

2 Answers2

1

use python3, if you use python2.x many letters like accents or others, they cause abnormal crashes

Ro0t
  • 179
  • 8
0

try this:

a.encode('utf-8').strip()

if "a" is the string with non-ascii character

Ro0t
  • 179
  • 8