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 *

19
  • If you run it like this what happens: python manage.py runserver 127.0.0.1:8000 Commented Sep 27, 2019 at 13:32
  • What is your hostname? Does it have special characters in it? Commented Sep 27, 2019 at 13:34
  • I tried this nothing happend same error Commented Sep 27, 2019 at 13:38
  • If you have aliases for your localhost in your host file with characters that are non utf-8 you probably will get this error. Commented Sep 27, 2019 at 13:40
  • @RemcoGerlich i just run this command it give me error but not in tutorial i simply just created project and then run python manage.py runserver command and it gave me error but not in tutorial Commented Sep 27, 2019 at 13:40

2 Answers 2

0

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

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.