Django Multiverse
Django Multiverse: A Multi-Tenancy reusable Django app that provides a robust and flexible way to manage tenants in your Django project. This package is distinguished from the popular django-tenants because it separates the tenants into different databases. (Currently supports SQLite and PostgreSQL).
Features
- Easy integration with existing Django projects
- Support for multiple Django versions (4.0, 4.1, 4.2, 5.0)
- Compatible with Python 3.10, 3.11, and 3.12
- Tenant separation in different databases
- Middleware for tenant-aware requests
- Utilities for tenant management
- Support for Django Rest Framework (DRF) and Django Q2
- MIT License
Installation
To install Django Multiverse, you can use pip:
pip install django-multiverse
Alternatively, you can add it to your pyproject.toml file:
[tool.poetry.dependencies]
django-multiverse = "^1.0.1"
Usage
To use Django Multiverse in your project, follow these steps:
-
Add
multiverseto yourINSTALLED_APPSinsettings.py:INSTALLED_APPS = [ ... 'multiverse', ... ]
-
Configure your middleware to include
TenantMiddleware:MIDDLEWARE = [ ... 'django_multiverse.middleware.TenantMiddleware', ... ]
-
Define your tenant model and configure it in your settings:
TENANT_MODEL = 'yourapp.Tenant'
-
Separate the apps per system, tenant or common to both:
SYSTEM_APPS = [ # ... 'app0', ] COMMON_APPS = [ # ... 'app1', 'app2', ] TENANT_APPS = [ # ... 'app3' ] INSTALLED_APPS = SYSTEM_APPS + COMMON_APPS + TENANT_APPS
-
Run the migrations
-
To create a tenant, use the management command:
python manage.py create_tenant <subdomain> --database-name <database_name> --create-database --migrate
-
To destroy a tenant, use the management command:
python manage.py destroy_tenant <lookup> --drop-database
Contributing
Contributions are welcome! Please feel free to submit a Pull Request or open an issue on our GitHub repository.
Draft Mode
Although this library is being used in production in some of my projects, this documentation is currently a draft. If you are interested in exploring further, you are welcome to open a pull request with your questions, and I will gladly assist you if I can.
License
This project is licensed under the MIT License.
Thank you for reading!
If you like this library, you can support me by buying me a coffee.
Metadata
Release files for django-multiverse 1.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_multiverse-1.0.9.tar.gz | 11.8 kB | Without provenance | Details for django_multiverse-1.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_multiverse-1.0.9-py3-none-any.whl | Python 3 | none | any | Details for django_multiverse-1.0.9-py3-none-any.whl |
Total release size: 28.7 kB
Release files / django_multiverse-1.0.9.tar.gz
| Download URL | django_multiverse-1.0.9.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a334e4afeffb08af0e5e703102704eec907084ba2b5578f9e248d24db9238184
|
|
BLAKE2b-256 checksum How to use checksums |
3fbed6ee3e2f104aba71580b9f605d3cabdc5cce238dd2d2e6782f2481901a4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.13.0 Darwin/23.6.0
|
Release files / django_multiverse-1.0.9-py3-none-any.whl
| Download URL | django_multiverse-1.0.9-py3-none-any.whl |
|---|---|
| Size | 16.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
27b9cffda88291775f53bd10a7a9d937a1f6243336c32fd22c2240ffddc0d449
|
|
BLAKE2b-256 checksum How to use checksums |
a71ddc656fc0523b658659f894701eb8be509ecef1099a406c6598eb195046c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.13.0 Darwin/23.6.0
|
Security for django-multiverse 1.0.9
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.