[Django] #37022: manage.py runserver fails with "nodename nor servname provided" when run using an rfc6761 hostname

12 views
Skip to first unread message

Django

unread,
Apr 3, 2026, 12:04:29 PM (5 days ago) Apr 3
to django-...@googlegroups.com
#37022: manage.py runserver fails with "nodename nor servname provided" when run
using an rfc6761 hostname
-------------------------------+-----------------------------------------
Reporter: Chris Rose | Type: Uncategorized
Status: new | Component: Utilities
Version: 5.2 | Severity: Normal
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
-------------------------------+-----------------------------------------
{{{
$ uv run manage.py runserver nomnom.dev.localhost:8441
Watching for file changes with StatReloader
2026-04-03T15:53:16.440737Z [info ] Watching for file changes with
StatReloader [django.utils.autoreload]
Performing system checks...

System check identified no issues (0 silenced).
Error: [Errno 8] nodename nor servname provided, or not known
}}}

`nomnom.dev.localhost` doesn't directly resolve in DNS, but it is a valid
RFC 6761 special use domain.

I've attached my settings, and because ALLOWED_HOSTS is relevant, here's
that value from manage.py shell:

{{{
uv run manage.py shell
45 objects imported automatically (use -v 2 for details).

Python 3.13.12 (main, Feb 3 2026, 17:53:27) [Clang 17.0.0
(clang-1700.6.3.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.conf import settings
>>> settings.ALLOWED_HOSTS
['nomnom.dev.localhost']
>>>
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/37022>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 3, 2026, 12:04:49 PM (5 days ago) Apr 3
to django-...@googlegroups.com
#37022: manage.py runserver fails with "nodename nor servname provided" when run
using an rfc6761 hostname
-------------------------------+--------------------------------------
Reporter: Chris Rose | Owner: (none)
Type: Uncategorized | Status: new
Component: Utilities | Version: 5.2
Severity: Normal | Resolution:
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
-------------------------------+--------------------------------------
Changes (by Chris Rose):

* Attachment "settings.py" added.

Django

unread,
Apr 3, 2026, 1:59:42 PM (5 days ago) Apr 3
to django-...@googlegroups.com
#37022: manage.py runserver fails with "nodename nor servname provided" when run
using an rfc6761 hostname
-------------------------------+--------------------------------------
Reporter: Chris Rose | Owner: (none)
Type: Uncategorized | Status: new
Component: Utilities | Version: 5.2
Severity: Normal | Resolution:
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):

[https://docs.djangoproject.com/en/dev/ref/django-admin/#runserver The
documentation for runserver] says, "You can pass in an IP address and port
number explicitly."

There's an example with localhost, but I don't know that hostnames are
otherwise supported. Have you looked at the code to identify where you
believe Django is at fault?
--
Ticket URL: <https://code.djangoproject.com/ticket/37022#comment:1>

Django

unread,
Apr 3, 2026, 4:23:03 PM (5 days ago) Apr 3
to django-...@googlegroups.com
#37022: manage.py runserver fails with "nodename nor servname provided" when run
using an rfc6761 hostname
-------------------------------+--------------------------------------
Reporter: Chris Rose | Owner: (none)
Type: Uncategorized | Status: new
Component: Utilities | Version: 5.2
Severity: Normal | Resolution:
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
-------------------------------+--------------------------------------

Old description:

> {{{
> $ uv run manage.py runserver nomnom.dev.localhost:8441
> Watching for file changes with StatReloader
> 2026-04-03T15:53:16.440737Z [info ] Watching for file changes with
> StatReloader [django.utils.autoreload]
> Performing system checks...
>
> System check identified no issues (0 silenced).
> Error: [Errno 8] nodename nor servname provided, or not known
> }}}
>
> `nomnom.dev.localhost` doesn't directly resolve in DNS, but it is a valid
> RFC 6761 special use domain.
>
> I've attached my settings, and because ALLOWED_HOSTS is relevant, here's
> that value from manage.py shell:
>
> {{{
> uv run manage.py shell
> 45 objects imported automatically (use -v 2 for details).
>
> Python 3.13.12 (main, Feb 3 2026, 17:53:27) [Clang 17.0.0
> (clang-1700.6.3.2)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)
> >>> from django.conf import settings
> >>> settings.ALLOWED_HOSTS
> ['nomnom.dev.localhost']
> >>>
> }}}

New description:

{{{
$ uv run manage.py runserver nomnom.dev.localhost:8441
Watching for file changes with StatReloader
2026-04-03T15:53:16.440737Z [info ] Watching for file changes with
StatReloader [django.utils.autoreload]
Performing system checks...

System check identified no issues (0 silenced).
Error: [Errno 8] nodename nor servname provided, or not known
}}}

`nomnom.dev.localhost` doesn't directly resolve in DNS, but it is a valid
RFC 6761 special use domain.

I've attached my settings, and because ALLOWED_HOSTS is relevant, here's
that value from manage.py shell:

{{{
uv run manage.py shell
45 objects imported automatically (use -v 2 for details).

Python 3.13.12 (main, Feb 3 2026, 17:53:27) [Clang 17.0.0
(clang-1700.6.3.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.conf import settings
>>> settings.ALLOWED_HOSTS
['nomnom.dev.localhost']
>>>
}}}

--
Comment (by Chris Rose):

Nope. I've been utterly unable to get a stack trace to appear. --traceback
did nothing for me either.
--
Ticket URL: <https://code.djangoproject.com/ticket/37022#comment:2>

Django

unread,
Apr 4, 2026, 8:07:40 AM (5 days ago) Apr 4
to django-...@googlegroups.com
#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
-------------------------------+--------------------------------------
Changes (by Sarah Boyce):

* resolution: => worksforme
* status: new => closed

Comment:

{{{
$ python manage.py runserver nomnom.dev.localhost:8441

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

System check identified no issues (0 silenced).
April 04, 2026 - 12:04:50
Django version 5.2.9, using settings 'example.settings'
Starting development server at http://nomnom.dev.localhost:8441/
Quit the server with CONTROL-C.

WARNING: This is a development server. Do not use it in a production
setting. Use a production WSGI or ASGI server instead.
For more information on production servers see:
https://docs.djangoproject.com/en/5.2/howto/deployment/
}}}

This works for me. So I wonder if this is something to do with your setup,
perhaps try running `ping nomnom.dev.localhost`?
--
Ticket URL: <https://code.djangoproject.com/ticket/37022#comment:3>

Django

unread,
Apr 4, 2026, 9:49:21 AM (4 days ago) Apr 4
to django-...@googlegroups.com
#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 Chris Rose):

`nomnom.dev.localhost` does not resolve for me in DNS.

https://datatracker.ietf.org/doc/html/rfc6761#section-6.3 suggests that
it's supposed to resolve to loopback.

{{{
$ ping nomnom.dev.localhost
ping: cannot resolve nomnom.dev.localhost: Unknown host
$ dig @ns-59.awsdns-07.com nomnom.dev.localhost
$ dig @8.8.8.8 nomnom.dev.localhost
$ dog @8.8.8.8 nomnom.dev.localhost
Status: NXDomain
SOA 23h59m55s A "a.root-servers.net." "nstld.verisign-grs.com."
2026040400 30m00s 15m00s 7d0h00m00s 1d0h00m00s
}}}

From what I can tell, it doesn't resolve anywhere, so I'm not sure what my
local setup is going to be doing with it.

At a bare minimum I sure would love it if `--traceback` would show me
where this resolution is happening, so that I can attempt to troubleshoot
it in more detail, but I can't get a stack trace out of that command.
--
Ticket URL: <https://code.djangoproject.com/ticket/37022#comment:4>

Django

unread,
Apr 4, 2026, 12:58:06 PM (4 days ago) Apr 4
to django-...@googlegroups.com
#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>
Reply all
Reply to author
Forward
0 new messages