Opened 3 hours ago

Last modified 83 minutes ago

#37022 new Uncategorized

manage.py runserver fails with "nodename nor servname provided" when run using an rfc6761 hostname

Reported by: Chris Rose Owned by:
Component: Utilities Version: 5.2
Severity: Normal Keywords: dns runserver
Cc: Chris Rose Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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']
>>>

Attachments (1)

settings.py (15.6 KB ) - added by Chris Rose 3 hours ago.

Download all attachments as: .zip

Change History (2)

by Chris Rose, 3 hours ago

Attachment: settings.py added

comment:1 by Tim Graham, 83 minutes ago

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?

Note: See TracTickets for help on using tickets.
Back to Top