Как исправить данную ошибку в Django?
Недавно начал изучать Django, выскакивает ошибка при запуске локального сервера: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 8: invalid continuation byte . Имя пользователя на английском. Пытался вводить python manage.py runserver 8000 а так же python manage.py 127.0.0.1:8000. Я подавлен, поэтому не могу сейчас нормально мыслить. Подскажите, в чём моя проблема? Слышал, что тут вина питона:
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
August 20, 2020 - 11:42:21
Django version 3.1, using settings 'newsite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Exception in thread django-main-thread:
Traceback (most recent call last):
File "C:\Users\megared\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\megared\AppData\Local\Programs\Python\Python38-32\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "D:\Games\siteone\venv\lib\site-packages\django\utils\autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "D:\Games\siteone\venv\lib\site-packages\django\core\management\commands\runserver.py", line 139, in inner_run
run(self.addr, int(self.port), handler,
File "D:\Games\siteone\venv\lib\site-packages\django\core\servers\basehttp.py", line 206, in run
httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
File "D:\Games\siteone\venv\lib\site-packages\django\core\servers\basehttp.py", line 67, in __init__
super().__init__(*args, **kwargs)
File "C:\Users\megared\AppData\Local\Programs\Python\Python38-32\lib\socketserver.py", line 452, in __init__
self.server_bind()
File "C:\Users\megared\AppData\Local\Programs\Python\Python38-32\lib\wsgiref\simple_server.py", line 50, in server_bind
HTTPServer.server_bind(self)
File "C:\Users\megared\AppData\Local\Programs\Python\Python38-32\lib\http\server.py", line 139, in server_bind
self.server_name = socket.getfqdn(host)
File "C:\Users\megared\AppData\Local\Programs\Python\Python38-32\lib\socket.py", line 756, in getfqdn
hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 8: invalid continuation byte
Ответы (1 шт):
Проблема в том, что имя вашего компьютера содержит кириллические символы.
Hostnames are composed of series of labels concatenated with dots, as are all domain names. For example, "en.wikipedia.org" is a hostname. Each label must be between 1 and 63 characters long, and the entire hostname (including the delimiting dots but not a trailing dot) has a maximum of 253 ASCII characters.
The Internet standards for protocols mandate that component hostname labels may contain only the ASCII letters 'a' through 'z' (in a case-insensitive manner), the digits '0' through '9', and the hyphen ('-'). The original specification of hostnames in RFC 952, mandated that labels could not start with a digit or with a hyphen, and must not end with a hyphen. However, a subsequent specification (RFC 1123) permitted hostname labels to start with digits. No other symbols, punctuation characters, or white space are permitted.