#37022: manage.py runserver fails with "nodename nor servname provided" when run
using an rfc6761 hostname
-------------------------------+--------------------------------------
     Reporter:  Chris Rose     |                    Owner:  (none)
         Type:  Uncategorized  |                   Status:  closed
    Component:  Utilities      |                  Version:  5.2
     Severity:  Normal         |               Resolution:  worksforme
     Keywords:  dns runserver  |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Comment (by Tim Graham):

 It also works on my system (Ubuntu 24.04):
 {{{
 $ ping nomnom.dev.localhost
 PING nomnom.dev.localhost (::1) 56 data bytes
 64 bytes from ip6-localhost (::1): icmp_seq=1 ttl=64 time=0.038 ms

 $ dig nomnom.dev.localhost

 ; <<>> DiG 9.18.39-0ubuntu0.24.04.3-Ubuntu <<>> nomnom.dev.localhost
 ;; global options: +cmd
 ;; Got answer:
 ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24028
 ;; flags: qr aa rd ra ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

 ;; OPT PSEUDOSECTION:
 ; EDNS: version: 0, flags:; udp: 65494
 ;; QUESTION SECTION:
 ;nomnom.dev.localhost.          IN      A

 ;; ANSWER SECTION:
 nomnom.dev.localhost.   0       IN      A       127.0.0.1

 ;; Query time: 0 msec
 ;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
 ;; WHEN: Sat Apr 04 12:36:37 EDT 2026
 ;; MSG SIZE  rcvd: 65
 }}}

 To see a traceback, edit the `except OSError as e:` line in
 `django/core/management/runserver.py`. Here's an example if I use an
 invalid hostname:
 {{{
 Traceback (most recent call last):
   File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
     self.run()
   File "/usr/lib/python3.12/threading.py", line 1010, in run
     self._target(*self._args, **self._kwargs)
   File "/home/tim/code/django/django/utils/autoreload.py", line 83, in
 wrapper
     raise e
   File "/home/tim/code/django/django/utils/autoreload.py", line 66, in
 wrapper
     fn(*args, **kwargs)
   File
 "/home/tim/code/django/django/core/management/commands/runserver.py", line
 144, in inner_run
     run(
   File "/home/tim/code/django/django/core/servers/basehttp.py", line 265,
 in run
     httpd = httpd_cls(server_address, WSGIRequestHandler, ipv6=ipv6)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   File "/home/tim/code/django/django/core/servers/basehttp.py", line 78,
 in __init__
     super().__init__(*args, **kwargs)
   File "/usr/lib/python3.12/socketserver.py", line 457, in __init__
     self.server_bind()
   File "/usr/lib/python3.12/wsgiref/simple_server.py", line 50, in
 server_bind
     HTTPServer.server_bind(self)
   File "/usr/lib/python3.12/http/server.py", line 136, in server_bind
     socketserver.TCPServer.server_bind(self)
   File "/usr/lib/python3.12/socketserver.py", line 473, in server_bind
     self.socket.bind(self.server_address)
 socket.gaierror: [Errno -2] Name or service not known
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/37022#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/0107019d596e10a1-25cdd29b-40ff-49be-8040-95c96cdb17d3-000000%40eu-central-1.amazonses.com.

Reply via email to