This app uses PostgreSQL schemas to support data multi-tenancy in a single Django project. It is a fork of django-tenants with some conceptual changes:
- There are static tenants and dynamic tenants. Static tenants can have their own apps and urlconf.
- Tenants can be simultaneously routed via subdomain and via subfolder on shared subdomain.
- Public is no longer the schema for storing the main site data. Public should be used only for true shared data across all tenants. Table "overriding" via search path is no longer encouraged.
- Management commands can be run on multiple schemas via wildcards - the multiproc behavior of migrations was extended to just any tenant command.
There are currently multiple packages to handle multi-tenancy via PostgreSQL schemas. This table should help you make an informed decision on which one to choose.
Package | Features |
---|---|
django-tenant-schemas | Original project. Now active and maintained by @goodtune. |
django-tenants | Active and maintained by @tomturner.
Built on top of django-tenant-schemas.
Uses a Domain model for allowing multiple domains per tenant.
Allows for parallel migrations with custom migration executor.
Other multiple improvements. |
django-pgschemas | Active and maintained by @lorinkoz. Built on top of django-tenants. Different philosphy for tenants. Other improvements listed above. |
https://django-pgschemas.readthedocs.io/
- Join the discussion at https://gitter.im/django-pgschemas/community.
- PRs are welcome! If you have questions or comments, please use the link above.
- To run the test suite run
make
ormake coverage
. The tests for this project live inside a small django project calleddpgs_sandbox
. Database password and database host can be set through the environment variablesDATABASE_PASSWORD
andDATABASE_HOST
.
- Tom Turner for django-tenants
- Bernardo Pires for django-tenant-schemas