Skip to main content

A comprehensive Django multi-tenancy solution with schema isolation, tenant-aware middleware, and flexible routing

Project description

django-tenantkit

CI Python Django License

A Django-native multitenancy framework focused on explicit isolation strategies, clear shared-versus-tenant boundaries, and integration with Django middleware, routing, admin, and provisioning workflows.


Why this package?

Multi-tenant Django systems often need different trade-offs depending on scale, operational model, and isolation requirements. Some solutions focus primarily on PostgreSQL schema isolation, while others assume a narrower routing or provisioning model.

This project aims to provide a more flexible foundation for Django applications that need:

  • explicit tenant isolation strategies
  • clear separation between shared/public and tenant-scoped data
  • Django-native integration points instead of a parallel platform model
  • a path toward a reusable package plus a reference example project

Supported isolation strategies

The framework currently supports two primary isolation modes:

Strategy Description Best fit
schema Multiple PostgreSQL schemas inside one shared database Shared infrastructure with strong logical isolation
database A dedicated database per tenant Stronger operational isolation and backend flexibility

The shared/public control plane remains separate from tenant-scoped runtime behavior.

See Concepts for the model vocabulary and architectural terms.


Installation

This repository uses a package-first layout. The reusable package lives under src/tenantkit, while example/ contains the reference Django project.

For the current setup and integration path, see:


Minimal quickstart

At a high level, a Django project using the framework will:

  1. add the multitenancy app to INSTALLED_APPS
  2. add tenant-aware middleware
  3. add the tenant database router
  4. define shared and tenant-scoped models
  5. create one or more tenants
  6. run the appropriate migration workflow

The current reference Django project lives in example/, while the package source lives in src/tenantkit.

For the guided flow, see Quickstart.


Official test command

The current stable validation path is:

uv sync --dev
uv run python example/manage.py test tenantkit

For local development, the repository is managed from the root and the example project acts as a consumer of the package.

See Testing for the current testing entrypoints.


Example project

The repository includes a Django reference project in example/. It currently serves as:

  • the integration environment
  • the test harness
  • the reference wiring for settings, middleware, routing, and admin behavior

The reusable package itself lives in src/tenantkit.

See Example Project.


Documentation

Public documentation:

Technical and architectural material:


Compatibility

Project status Python Django
Current main branch 3.12, 3.13 6.0
  • Schema isolation requires PostgreSQL
  • Database isolation depends on backend-specific provisioning and runtime support

Status

This project is under active development.

Current transition goals include:

  • refining the public documentation structure
  • stabilizing the new package-first repository layout
  • keeping the example/ project as the reference integration environment

Contributing

See CONTRIBUTING.md. All changes should go through Pull Requests.


License

MIT License. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_tenantkit_core-0.1.0.tar.gz (53.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_tenantkit_core-0.1.0-py3-none-any.whl (69.1 kB view details)

Uploaded Python 3

File details

Details for the file django_tenantkit_core-0.1.0.tar.gz.

File metadata

  • Download URL: django_tenantkit_core-0.1.0.tar.gz
  • Upload date:
  • Size: 53.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for django_tenantkit_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9fd66fa9aa79f6ca6016a5dd1e76a77350cc36db1f97cfb1880abcfb0b1b962a
MD5 7f98f354dc6892306c1debe69c74f58b
BLAKE2b-256 56500299a30eb2664709d63eb56d495fc4a15141fe3f17c2de2426c163edb43b

See more details on using hashes here.

File details

Details for the file django_tenantkit_core-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_tenantkit_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68a5925b02f9a18cee7f334567907862c132e1604e0f715b739fffb16188f713
MD5 70e7910b3a20f574a23e9bc9bc0eb3fa
BLAKE2b-256 87916ca431f323ef31f9c7326ecd8f4a9e6a9a9e567f15a190b954316a306b43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page