0

I have started learning django this was my first tutorial. First i ran django-admin startproject This command works according to tutorial but when I run this command python manage.py runserver Following Error Occurs but not in tutorial video

*Watching for file changes with StatReloader  
Performing system checks...

System check identified no issues (0 silenced).  
September 27, 2019 - 18:01:04  
Django version 2.2.5, using settings 'first.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\MuBasHer\AppData\Local\Programs\Python\Python37\lib\threading.py", line 917, in _bootstrap_inner self.run() File "C:\Users\MuBasHer\AppData\Local\Programs\Python\Python37\lib\threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "C:\Users\MuBasHer\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper fn(*args, **kwargs) File "C:\Users\MuBasHer\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\runserver.py", line 139, in inner_run ipv6=self.use_ipv6, threading=threading, server_cls=self.server_cls) File "C:\Users\MuBasHer\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py", line 203, in run httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6) File "C:\Users\MuBasHer\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py", line 67, in init
super().init(*args, **kwargs) File "C:\Users\MuBasHer\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 449, in init self.server_bind() File "C:\Users\MuBasHer\AppData\Local\Programs\Python\Python37\lib\wsgiref\simple_server.py", line 50, in server_bind HTTPServer.server_bind(self) File "C:\Users\MuBasHer\AppData\Local\Programs\Python\Python37\lib\http\server.py", line 139, in server_bind self.server_name = socket.getfqdn(host) File "C:\Users\MuBasHer\AppData\Local\Programs\Python\Python37\lib\socket.py", line 676, in getfqdn hostname, aliases, ipaddrs = gethostbyaddr(name) UnicodeDecodeError: 'utf-8' codec can't decode byte 0xae in position 6: invalid start byte *

Brown Bear
  • 19,655
  • 10
  • 58
  • 76
Mubasher Ali
  • 502
  • 6
  • 14

2 Answers2

0

You need to change hostname in Windows to remove any not UTF-8 characters.

Mark Barrett
  • 366
  • 2
  • 16
0

first of all, I assume you are using the windows command-line tool as your shell.

If so, then run the command-line tool as administrator and cd into your project directory, switch into your working(virtual environment), then run the python manage.py runserver command again.

With these few steps you can startup your development server. thanks

Reznik
  • 2,663
  • 1
  • 11
  • 31
Edrose
  • 1