$npx skillfedfor your agent

django-hosts

Dynamic and static host resolving for Django. Maps hostnames to URLconfs.

Worth itPyPI Dynamic ContentReleased Jun 2025397.7K downloads / moBSDPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — django_hosts-7.0.0-py3-none-any.whl
v7.0.0 · released 2025-06-19 · Python >=3.9

Yes. django-hosts is production-stable, actively maintained, has no external dependencies, and solves a common Django deployment pattern cleanly. Use it when you need to route multiple subdomains to different URL schemes within a single Django project—it's the standard tool for this task.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Low install friction with no runtime dependencies.
  • Active maintenance with recent commits and a stable release cadence; supports current Python versions (3.9–3.13) and modern Django releases (4.2, 5.1, 5.2).

License · maintenance · safety

BSD (permissive) — BSD license is permissive, allowing commercial and private use with minimal restrictions—suitable for most projects.

last release 2025-06-19 (421 days) · last repo commit 2026-06-29 · 1,060 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 397,715 downloads/mo, #6,956 on PyPI

Verify before relying

pip install django-hosts

# In hosts.py:
from django_hosts import patterns, host

host_patterns = patterns('',
    host(r'api', 'api.urls', name='api'),
    host(r'beta', 'beta.urls', name='beta'),
)

# In settings.py:
INSTALLED_APPS = ['django_hosts', ...]
MIDDLEWARE = ['django_hosts.middleware.HostsRequestMiddleware', ...]
ROOT_HOSTCONF = 'mysite.hosts'
DEFAULT_HOST = 'api'
Same gist for agents: .md · .json

What it is and what it does

django-hosts is a Django middleware package that intercepts incoming HTTP requests and routes them to different URL configurations based on the hostname. Instead of handling multiple subdomains within a single URLconf, you define separate hostconfs—modules containing URL patterns—and map hostnames (or patterns matching hostnames) to them. Requests to api.example.com route to one URLconf, beta.example.com to another, and unmatched hosts fall back to the default ROOT_URLCONF.

The package uses regular expressions to match hostnames against patterns, evaluated in order. It requires minimal configuration: add two middleware classes to your MIDDLEWARE setting, create a hosts.py file with your host patterns, and set ROOT_HOSTCONF and DEFAULT_HOST in settings. No runtime dependencies means a lightweight addition to any Django project.

Use it for

  • Serve an API on api.example.com with its own URL structure separate from the main site.
  • Host a beta version at beta.example.com with different views and routes than production.
  • Route multiple branded subdomains to different content or applications within one Django project.
  • Implement multi-tenant deployments where each tenant's subdomain maps to its own URL configuration.
  • Separate admin interfaces, documentation, or internal tools onto dedicated subdomains.

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

django-hosts is production-stable, actively maintained, has no external dependencies, and solves a common Django deployment pattern cleanly. Use it when you need to route multiple subdomains to different URL schemes within a single Django project—it's the standard tool for this task.

Install

django-hosts on PyPI

Before you install

Low install friction with no runtime dependencies. Active maintenance with recent commits and a stable release cadence; supports current Python versions (3.9–3.13) and modern Django releases (4.2, 5.1, 5.2).

License in practice

BSD license is permissive, allowing commercial and private use with minimal restrictions—suitable for most projects.

Quickstart

pip install django-hosts

# In hosts.py:
from django_hosts import patterns, host

host_patterns = patterns('',
    host(r'api', 'api.urls', name='api'),
    host(r'beta', 'beta.urls', name='beta'),
)

# In settings.py:
INSTALLED_APPS = ['django_hosts', ...]
MIDDLEWARE = ['django_hosts.middleware.HostsRequestMiddleware', ...]
ROOT_HOSTCONF = 'mysite.hosts'
DEFAULT_HOST = 'api'

Package facts

LicenseBSD permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceActively maintained 421 days since the last release
Last repo commit
First released
Downloads397,715 / month, #6,956 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.1Framework :: Django :: 5.2Intended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9

Evidence: django_hosts-7.0.0-py3-none-any.whl

Tags

Capabilities
django subdomain routingmulti-host djangohostname-based url routingdjango virtual hostssubdomain url configurationdjango request routing by hostdynamic host resolution django
Topics
django-middlewaresubdomain-routingmulti-tenant

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “django subdomain routing”

  • django-hostsRoutes HTTP requests to different Django URL configurations based on…
  • tldparseParses domain names into their constituent parts (subdomain, domain,…
  • tldextractAccurately extracts subdomain, domain, and public suffix from URLs…

Give your agent the search over MCP, or paste the wish link into any chat.

More Dynamic Content packages

MarkupSafe Worth it
PyPI · Dynamic Content · released Sep 2025

MarkupSafe provides a text object that escapes special characters so untrusted strings can be safely embedded in HTML and XML without injection attacks.

BSD-3-Clausecompiled wheel · 3.9+aging
797.1Mdownloads / mo
Jinja2 Worth it
PyPI · Dynamic Content · released Mar 2025

Jinja2 is a templating engine that renders dynamic content by combining templates with Python-like syntax and data, supporting template inheritance, macros, autoescaping, and sandboxed execution.

BSD-3-Clausepure Python · 3.7+aging
718.6Mdownloads / mo
soupsieve Worth it
PyPI · Python Modules · released Aug 2026

Soupsieve is a CSS selector library designed to work with Beautiful Soup 4 to select, match, and filter HTML and XML elements using modern CSS selectors from CSS level 1 through CSS level 4 specifications.

Install it if you use Beautiful Soup for HTML or XML parsing and want modern CSS selector support.

MITpure Python · 3.10+
428.6Mdownloads / mo
Werkzeug Worth it
PyPI · Application Frameworks · released Apr 2026

Werkzeug is a WSGI utility library providing request/response objects, URL routing, an interactive debugger, HTTP utilities, and a development server for building web applications.

BSD-3-Clausepure Python · 3.9+
268.1Mdownloads / mo
Flask Worth it
PyPI · Application Frameworks · released Feb 2026

Flask is a lightweight WSGI web application framework for building web applications in Python, from simple single-page sites to complex multi-route applications.

BSD-3-Clausepure Python · 3.9+
211.4Mdownloads / mo
Mako Worth it
PyPI · Dynamic Content · released Aug 2026

Mako compiles Python-embedded templates into Python modules for fast rendering, supporting layout inheritance, custom functions, and direct Python expressions within template syntax.

MITpure Python · 3.10+
201.7Mdownloads / mo

See also dj-static · django-constance · drf-nested-routers · django-permissions-policy · django-cache-url · django-csp · tldparse · django-waffle · webapp2 · repath