/django-pgschemas

Django multi-tenancy through Postgres schemas

Primary LanguagePythonMIT LicenseMIT

django-pgschemas

Packaging: poetry Build status Documentation status Code coverage PyPi version Downloads

This app uses Postgres 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 routed via:
    • URL using subdomain or subfolder on shared subdomain
    • Session
    • Headers
  • Public is no longer the schema for storing the main site data. Public is only used for shared data across all tenants. Table "overriding" via search path is not encouraged.
  • Management commands can be run on multiple schemas via wildcards, either sequentially or in parallel using multithreading.

Documentation

https://django-pgschemas.readthedocs.io/

Contributing

  • Join the discussion at https://github.com/lorinkoz/django-pgschemas/discussions.
  • PRs are welcome! If you have questions or comments, please use the discussions link above.
  • To run the test suite run make or make coverage. The tests for this project live inside a small django project called sandbox.

Credits