Skip to main content
The Clients module handles the public schema and domain mapping necessary for django-tenants to function. This module resides globally and is typically only interacted with by superusers or system administrators via the public domain.

Tenant Model (Client)

A Client represents a school or overarching organizational space. Key responsibilities:
  • Holds metadata like schema_name and name (e.g., "school_a", "Greenwood High").
  • Governs the creation of the isolated database schema.

Domain Model (Domain)

Links a custom DNS record or subdomain to a Client. Example:
  • app.schoola.com -> school_a schema.
  • schoolb.sms.local -> school_b schema.
A Domain must explicitly point to a created Client. The system will throw a 404 error if an unmapped domain connects to the server, as the middleware won’t know which schema to SearchPath.

Integration with Django Apps

Once a request comes in on a known Domain, django-tenants transparently scopes all subsequent database ORM calls during that request to the target schema.