Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Error: [Errno 11001] getaddrinfo failed" on Windows #1669

Open
horeoryang opened this issue Jul 14, 2020 · 9 comments
Open

"Error: [Errno 11001] getaddrinfo failed" on Windows #1669

horeoryang opened this issue Jul 14, 2020 · 9 comments

Comments

@horeoryang
Copy link

horeoryang commented Jul 14, 2020

Issue Discription
(myvenv) C:\Users\rkfql\djangogirls>python manage.py runserver 0:8000
Performing system checks...

System check identified no issues (0 silenced).
July 14, 2020 - 23:15:38
Django version 2.0.13, using settings 'mysite.settings'
Starting development server at http://0:8000/
Quit the server with CTRL-BREAK.
Error: [Errno 11001] getaddrinfo failed
Operating system : WIndows 10
how to solve this error?

@ekohl
Copy link
Collaborator

ekohl commented Jul 14, 2020

I don't know a lot about Windows, but have you tried to listen on 0.0.0.0:8000 instead of 0:8000? If you leave that off entirely, does that work?

@magul
Copy link
Member

magul commented Jul 15, 2020

The only place, where I found 0:8000 in our tutorial is here: https://github.com/DjangoGirls/tutorial/blame/master/en/django_start_project/README.md#L184 and it looks, that it was proposed back in 2015: 6e428a4 as a resolution for some unicode problem.

Original commit message doesn't clearly say why we cannot use 0.0.0.0 or even 127.0.0.1.

Did you try 0.0.0.0:8000 or 127.0.0.0:8000 @horeoryang ?

@horeoryang
Copy link
Author

horeoryang commented Jul 18, 2020

Thank you for your reply. i try your solution that is both of you, but it can't work. i will attach the codes.

(myvenv) C:\Users\이시형\djangogirls>python manage.py runserver 0.0.0.0:8000
Performing system checks...

System check identified no issues (0 silenced).
July 18, 2020 - 13:14:28
Django version 2.0.13, using settings 'mysite.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.
Exception ignored in thread started by: <function check_errors.<locals>.wrapper at 0x000001B2C490BEE0>
Traceback (most recent call last):
  File "C:\Users\이시형\djangogirls\myvenv\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper
    fn(*args, **kwargs)
  File "C:\Users\이시형\djangogirls\myvenv\lib\site-packages\django\core\management\commands\runserver.py", line 141, in inner_run
    run(self.addr, int(self.port), handler,
  File "C:\Users\이시형\djangogirls\myvenv\lib\site-packages\django\core\servers\basehttp.py", line 163, in run
    httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
  File "C:\Users\이시형\djangogirls\myvenv\lib\site-packages\django\core\servers\basehttp.py", line 66, in __init__
    super().__init__(*args, **kwargs)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1264.0_x64__qbz5n2kfra8p0\lib\socketserver.py", line 452, in __init__
    self.server_bind()
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1264.0_x64__qbz5n2kfra8p0\lib\wsgiref\simple_server.py", line 50, in server_bind
    HTTPServer.server_bind(self)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1264.0_x64__qbz5n2kfra8p0\lib\http\server.py", line 140, in server_bind
    self.server_name = socket.getfqdn(host)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.1264.0_x64__qbz5n2kfra8p0\lib\socket.py", line 756, in getfqdn
    hostname, aliases, ipaddrs = gethostbyaddr(name)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 4: invalid start byte



(myvenv) C:\Users\이시형\djangogirls>python manage.py runserver 127.0.0.0:8000
Performing system checks...

System check identified no issues (0 silenced).
July 18, 2020 - 13:09:04
Django version 2.0.13, using settings 'mysite.settings'
Starting development server at http://127.0.0.0:8000/
Quit the server with CTRL-BREAK.
Error: That IP address can't be assigned to.

@ekohl
Copy link
Collaborator

ekohl commented Jul 18, 2020

It suggests your hostname has unicode in it and Python can't deal with that. https://bugs.python.org/issue26227 is still open. https://stackoverflow.com/questions/25948687/gethostbyaddr-raises-unicodedecodeerror-in-python-3 only has the workaround to rename the system.

@das-g das-g changed the title Window error "Error: [Errno 11001] getaddrinfo failed" on Windows Jul 20, 2020
@iirbdka
Copy link

iirbdka commented Oct 25, 2020

maybe your computer-name is not english. In my case, my computer name was 용준. and got same situation but after I change my computer name to enlish, It work! Try it.

@SteffPeff
Copy link

The IP address is still wrong: 127.0.0.0
it must be 127.0.0.1

@9z8
Copy link

9z8 commented Feb 9, 2021

you can try
socket.getaddrinfo('localhost', 8080)

@jocekar
Copy link

jocekar commented Jul 5, 2023

what is gaierror att error in django

@ekohl
Copy link
Collaborator

ekohl commented Jul 5, 2023

https://stackoverflow.com/questions/15246088/what-does-this-socket-gaierror-mean has a nice explanation. By now it looks like the original bug has been resolved in Python 3.8 and up, but I can't verify that. If anyone is still running into this, please verify that your Python version is new enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants