9
9
99sun662022-04-03 13:54:45
Django
99sun66, 2022-04-03 13:54:45

How to start a local django server?

Started learning django and python and already stuck on startup. I do everything according to the documentation here , here . The browser does not open the start page at 127.0.0.1:8000 or 127.0.0.1:8080 after entering the command manage.py runserver says "Unable to access the site Site 127.0.0.1 does not allow you to establish a connection."
I work on win 10.

From the console:

(venv) D:\pythonProject_test_siite\teatsite>python manage.py runserver 0.0.0.0:8000
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
April 03, 2022 - 14:10:51
Django version 4.0.3, using settings 'teatsite.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "C:\Users\nikalaev\AppData\Local\Programs\Python\Python39\lib\threading.py", line 954, in _bootstrap_inner
    self.run()
  File "C:\Users\nikalaev\AppData\Local\Programs\Python\Python39\lib\threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "D:\pythonProject_test_siite\venv\lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "D:\pythonProject_test_siite\venv\lib\site-packages\django\core\management\commands\runserver.py", line 158, in inner_run
    run(
  File "D:\pythonProject_test_siite\venv\lib\site-packages\django\core\servers\basehttp.py", line 236, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "D:\pythonProject_test_siite\venv\lib\site-packages\django\core\servers\basehttp.py", line 76, in __init__
    super().__init__(*args, **kwargs)
  File "C:\Users\nikalaev\AppData\Local\Programs\Python\Python39\lib\socketserver.py", line 452, in __init__
    self.server_bind()
  File "C:\Users\nikalaev\AppData\Local\Programs\Python\Python39\lib\wsgiref\simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "C:\Users\nikalaev\AppData\Local\Programs\Python\Python39\lib\http\server.py", line 140, in server_bind
    self.server_name = socket.getfqdn(host)
  File "C:\Users\nikalaev\AppData\Local\Programs\Python\Python39\lib\socket.py", line 791, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf in position 9: invalid continuation byte

From browser:
624983516906b594647384.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2022-04-03
@99sun66

the problem is easily googled, they are already tired of answering it
UPD Just yesterday it was https://qna.habr.com/q/1134912

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question