please help me about django error that encoding is wrong

47 views
Skip to first unread message

č¼å¤œäø‰ę—„꜈

unread,
Aug 22, 2017, 7:34:55ā€ÆAM8/22/17
to Django users

just create a django project in Pycharm which was in a virtual environment ,while it send me a unsolved problem about following things:



"C:\Program Files\JetBrains\PyCharm 2017.2.1\bin\runnerw.exe" C:\Users\Administrator\sampleā€”ā€”venv\Scripts\python.exe C:/Users/Administrator/PycharmProjects/untitle7/manage.py runserver 8000
Performing system checks...

System check identified some issues:

WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_DIRS.

System check identified 1 issue (0 silenced).
August 22, 2017 - 02:05:59
Django version 1.11.4, using settings 'untitle7.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 0x03827030>
Traceback (most recent call last):
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
Ā  Ā  fn(*args, **kwargs)
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 149, in inner_run
Ā  Ā  ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 164, in run
Ā  Ā  httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 74, in __init__
Ā  Ā  super(WSGIServer, self).__init__(*args, **kwargs)
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\Lib\socketserver.py", line 453, in __init__
Ā  Ā  self.server_bind()
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\Lib\wsgiref\simple_server.py", line 50, in server_bind
Ā  Ā  HTTPServer.server_bind(self)
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\Lib\http\server.py", line 138, in server_bind
Ā  Ā  self.server_name = socket.getfqdn(host)
Ā  File "C:\Users\Administrator\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 0: invalid start byte


just a empty project,I have done nothing but receive so many errors.I try to find some methods to solve it in starkflow or somewhere but,just find a unsolved question.

Vijay Khemlani

unread,
Aug 22, 2017, 7:49:52ā€ÆAM8/22/17
to django...@googlegroups.com
What is the hostname of your machine? If you are using Windows then you can execute "ipconfig /all" on a cmd prompt

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a5580eb5-2b2b-4207-becb-65e183144f2d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Schneider

unread,
Aug 22, 2017, 12:35:30ā€ÆPM8/22/17
to django...@googlegroups.com

System check identified 1 issue (0 silenced).
August 22, 2017 - 02:05:59
Django version 1.11.4, using settings 'untitle7.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 0x03827030>
Traceback (most recent call last):
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\utils\autoreload.py", line 228, in wrapper
Ā  Ā  fn(*args, **kwargs)
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\runserver.py", line 149, in inner_run
Ā  Ā  ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls)
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 164, in run
Ā  Ā  httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 74, in __init__
Ā  Ā  super(WSGIServer, self).__init__(*args, **kwargs)
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\Lib\socketserver.py", line 453, in __init__
Ā  Ā  self.server_bind()
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\Lib\wsgiref\simple_server.py", line 50, in server_bind
Ā  Ā  HTTPServer.server_bind(self)
Ā  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\Lib\http\server.py", line 138, in server_bind
Ā  Ā  self.server_name = socket.getfqdn(host)
Ā  File "C:\Users\Administrator\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 0: invalid start byte


I'm going to take a stab in the dark. From the traceback, it appears Django is trying to resolve the name of the host where you are running the development server, but the byte string it is getting back from the system calls querying the host name of your computer is not encoded using UTF-8 (or is getting a character string that is not being properly encoded), hence the decode errors.Ā 


There are also a bunch of references to this (Still open from 2010) Python bug:Ā http://bugs.python.org/issue9377 (socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names)

Try changing the name of your computer to use only ASCII characters (which should work around the encoding/decoding issues). If that works, I'm not entirely sure what the long-term solution is, but that should at least point you in the right direction when Googling.

-James

Reply all
Reply to author
Forward
0 new messages