Skip to main content

django-easy-tenants

Tests codecov PyPI Version PyPI downloads Documentation

A Django app for managing multiple tenants in the same project instance using the shared approach: one database and one schema for all tenants, with every tenant-isolated table referencing the tenant by a foreign key.

Documentation: https://django-easy-tenants.readthedocs.io/

Installation

python -m pip install django-easy-tenants

Quickstart

Add the app and point it to your tenant model:

# settings.py
INSTALLED_APPS = [
    ...,
    "easy_tenants",
]

EASY_TENANTS_TENANT_MODEL = "yourapp.Customer"

Make the models that must be isolated per tenant tenant-aware:

# yourapp/models.py
from django.db import models
from easy_tenants.models import TenantAwareAbstract, TenantManager


class Customer(models.Model):
    ...


class Product(TenantAwareAbstract):
    tenant = models.ForeignKey(Customer, on_delete=models.CASCADE, editable=False)
    name = models.CharField(max_length=10)

    objects = TenantManager()

Activate a tenant to query and create its data:

from easy_tenants import tenant_context

with tenant_context(customer):
    Product.objects.all()  # only the products of this customer
    Product.objects.create(name="Shirt")  # saved with tenant=customer

In views, a middleware activates the tenant of each request:

MIDDLEWARE = [
    ...,
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "easy_tenants.middleware.SessionTenantMiddleware",
]

See the documentation for the middlewares, per-tenant file storage, UniqueTenantConstraint, the shell_tenant command, the system checks and the API reference.

Metadata

Release files for django-easy-tenants 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-easy-tenants 0.11.0
File Size Uploaded Provenance Actions
django_easy_tenants-0.11.0.tar.gz 15.4 kB With provenance Details for django_easy_tenants-0.11.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-easy-tenants 0.11.0
File Interpreter ABI Platform Actions
django_easy_tenants-0.11.0-py3-none-any.whl Python 3 none any Details for django_easy_tenants-0.11.0-py3-none-any.whl

Total release size: 27.6 kB

Release files / django_easy_tenants-0.11.0.tar.gz

Download URL django_easy_tenants-0.11.0.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9808e26ddcf52d74a1a6a8c744ed14bc96a3bb3bf7956cca538ff507592d6078
BLAKE2b-256 checksum
How to use checksums
bc03fe3313e0b11b3595a0edd8ca50942187dd15e35959a70b5e7fb547075dd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / django_easy_tenants-0.11.0-py3-none-any.whl

Download URL django_easy_tenants-0.11.0-py3-none-any.whl
Size 12.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40f84d433e624b6ea4a694d4d107166241e3967d8e6e23401d617926f187b55d
BLAKE2b-256 checksum
How to use checksums
e5c3b86158ebe7e52c072cb680fc4c21f84dd52e327c09c33231a7049354cdae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for django-easy-tenants 0.11.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_easy_tenants-0.11.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page