$npx skillfedfor your agent

django-tenants

Tenant support for Django using PostgreSQL schemas.

Worth itPyPI Python ModulesReleased Aug 2026958.4K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — django_tenants-3.14.0-py3-none-any.whl
v3.14.0 · released 2026-08-05 · Python >=3.10 · 1 runtime deps: django

Yes. django-tenants is production-stable (Development Status 5), actively maintained, has no known vulnerabilities, and solves a real architectural problem for SaaS applications. The single django dependency and permissive MIT license remove friction. Install if you need schema-based multitenancy on PostgreSQL; it requires Django 2+ and PostgreSQL, and you must be comfortable with PostgreSQL schema concepts.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires PostgreSQL database backend and Django 2+; Python 3.10 or later.
  • Low install friction with a single runtime dependency on django.
  • Actively maintained with recent releases and a stable codebase (1882 GitHub stars, last commit 2026-08-10).

License · maintenance · safety

MIT (permissive) — MIT license permits commercial use, modification, and distribution with minimal restrictions—suitable for proprietary SaaS applications.

last release 2026-08-05 (9 days) · last repo commit 2026-08-10 · 1,882 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 958,398 downloads/mo, #4,641 on PyPI

Verify before relying

# Install
pip install django-tenants

# In settings.py
DATABASES = {
    'default': {
        'ENGINE': 'django_tenants.postgresql_backend',
        # ...
    }
}
MIDDLEWARE = (
    'django_tenants.middleware.main.TenantMainMiddleware',
    # ...
)
INSTALLED_APPS = [
    'django_tenants',
    # ...
]
TENANT_MODEL = "customers.Client"
TENANT_DOMAIN_MODEL = "customers.Domain"

# In models.py
from django_tenants.models import TenantMixin, DomainMixin

class Client(TenantMixin):
    name = models.CharField(max_length=100)

class Domain(DomainMixin):
    pass

# Run migrations
python manage.py migrate_schemas --shared
  • Whether the package handles tenant-specific migrations automatically or requires manual intervention
  • Performance characteristics under high tenant counts or concurrent request loads
  • Compatibility with Django's async views and async ORM features
Same gist for agents: .md · .json

What it is and what it does

django-tenants is a Django extension that implements the semi-isolated multitenancy pattern: one PostgreSQL database with separate schemas per tenant. It intercepts requests by hostname, routes them to the correct tenant schema, and makes all ORM queries operate transparently within that schema without requiring changes to your view code. The package manages schema creation, migration routing (shared vs. tenant-specific), and provides middleware to automatically set the PostgreSQL search path on each request.

You define a tenant model (e.g., Client) and a domain model to map hostnames to tenants. When a request arrives at tenant.example.com, the middleware looks up the tenant, sets the schema, and all subsequent database operations happen in that tenant's isolated space. This approach balances simplicity—minimal code changes needed—with performance benefits of shared connections and buffers compared to fully separate databases.

Use it for

  • Build a SaaS platform where each customer's data must be isolated but served from a single Django instance
  • Implement different views or configurations per tenant while reusing the same codebase and database connection pool
  • Manage shared data (e.g., billing, user accounts) in the public schema while keeping customer-specific tables in tenant schemas
  • Scale horizontally by running multiple application instances against the same PostgreSQL database with automatic tenant routing

Worth the install?

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

Worth it

Yes.

django-tenants is production-stable (Development Status 5), actively maintained, has no known vulnerabilities, and solves a real architectural problem for SaaS applications. The single django dependency and permissive MIT license remove friction. Install if you need schema-based multitenancy on PostgreSQL; it requires Django 2+ and PostgreSQL, and you must be comfortable with PostgreSQL schema concepts.

Install

django-tenants on PyPI

Before you install

Low install friction with a single runtime dependency on django. Actively maintained with recent releases and a stable codebase (1882 GitHub stars, last commit 2026-08-10).

Requires PostgreSQL database backend and Django 2+; Python 3.10 or later.

License in practice

MIT license permits commercial use, modification, and distribution with minimal restrictions—suitable for proprietary SaaS applications.

Quickstart

# Install
pip install django-tenants

# In settings.py
DATABASES = {
    'default': {
        'ENGINE': 'django_tenants.postgresql_backend',
        # ...
    }
}
MIDDLEWARE = (
    'django_tenants.middleware.main.TenantMainMiddleware',
    # ...
)
INSTALLED_APPS = [
    'django_tenants',
    # ...
]
TENANT_MODEL = "customers.Client"
TENANT_DOMAIN_MODEL = "customers.Domain"

# In models.py
from django_tenants.models import TenantMixin, DomainMixin

class Client(TenantMixin):
    name = models.CharField(max_length=100)

class Domain(DomainMixin):
    pass

# Run migrations
python manage.py migrate_schemas --shared

Verify before relying

  • Whether the package handles tenant-specific migrations automatically or requires manual intervention
  • Performance characteristics under high tenant counts or concurrent request loads
  • Compatibility with Django's async views and async ORM features

Package facts

LicenseMIT permissive
Python supportSupports the current Python release >=3.10
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
django
MaintenanceActively maintained 9 days since the last release
Last repo commit
First released
Downloads958,398 / month, #4,641 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 :: 5.2Framework :: Django :: 6.0Framework :: Django :: 6.1Programming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Software Development :: Libraries :: Python Modules

Evidence: django_tenants-3.14.0-py3-none-any.whl

Tags

Capabilities
django multitenancy postgres schemassaas tenant isolation djangodjango multiple customers one instancepostgresql schema-based tenantsdjango tenant routing by domain
Topics
multitenancysaaspostgresql

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 multitenancy postgres schemas”

  • django-tenantsEnables Django applications to serve multiple tenants from a single…
  • django-multitenantAdds multi-tenant database support to Django by automatically scoping…
  • django-pgmigratePrevents migration downtime by detecting and terminating blocking…

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

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also django-multitenant · tenant-schemas-celery · duplocloud-client · dj-materialized-views · django-db-connection-pool · schemainspect · migra · django-pgviews-redux · django-postgres-copy · django-pglock