Home Live demos hostmap
django-hostmap is the substrate for this whole demo network: it routes requests to per-package hosts from one codebase, and it is the reason every link between them just works, whether it stays on this host or jumps to another.
Full package: install, docs, changelog →
This is a live rendering of what manage.py hostmap prints on this server right now: every entry in the HOSTMAP setting, its effective host, and whether it routes, redirects, or wildcards.
No link on this page is a hard-coded URL. Each one is the output of a plain Django url template tag; hostmap decides, per call, whether the result stays relative or becomes absolute.
Compare the two "Same-host" rows above with any "Cross-host" row: same-host links, including the one to the /how/ page, stay relative because hostmap leaves them untouched; only cross-host links are rewritten absolute.
HostmapMiddleware matches request.get_host() against the map and sets request.urlconf. This request landed on the "hostmap" entry's URLconf because you asked for this host.
A patched resolver retries other entries' URLconfs on NoReverseMatch. Same-host names resolve exactly as stock Django always has, byte-identical.
When the match lands on a different entry, the result comes back as a full URL with scheme and host, so the link works regardless of which subdomain rendered the page.
Named acceptance criteria for hostmap, demonstrated rather than described.
Redirect entry
The apex domain (icvoss.com, no subdomain) is a redirect entry, not a routed one. It 301s to the default entry preserving path and query string.
Wildcard subdomain
The "preview" entry matches any single subdomain level not claimed by another entry. This demo network uses it to show wildcard capture, exposed as request.hostmap.subdomain.
Not every possible subdomain is in the resolved map above. HOSTMAP_UNMATCHED decides what happens when a request arrives for a host that is not.
This site: fail open (default)
With HOSTMAP_UNMATCHED = "default" (also the setting's own default, so most deployments get this for free), an unmapped host is not an error: it falls through to the default entry (www), and the visitor lands on the main site exactly as if they had typed it directly.
Try it yourself: pick any subdomain that is not one of the demo hosts above, for example https://anything.icvoss.com/, and you will land on the main site. That is the fail-open default in action, not a fallback error page.
The alternative: reject
Setting HOSTMAP_UNMATCHED = "reject" instead makes an unmapped host a hard 404: no fallback, no guessing which entry the visitor probably meant. This site does not use it; every subdomain it does not recognise is meant to still resolve to something useful.