One django library to rule all multi-tenant.
Project description
Django Ultratenant
Pitch (Portuguese)
- Part 1: https://www.loom.com/share/a90948958c184a0fb64868bbb0230a28
- Part 2: https://www.loom.com/share/52fd66b6f5a047f88a9fed56c1cf70d1
What is
-
Django multi-tenant library that implements diferent approaches
-
Simple API with minimal setup
-
Transparent for the application
-
Supported isolations approaches:
- multi-db
- multi-schema
- tenant-id
-
Supported URL approaches: subdomain and path
- tenant.url.com
- url.com/tenant/admin/
-
Support multiple databases
-
Good documentation
Contributing
Rules to contribute
Clone the code
git clone https://github.com/HBN3tw0rk/django-ultratenant
cd django-ultratenant
git checkout main
Or
git clone git@github.com:HBN3tw0rk/django-ultratenant.git
cd django-ultratenant
git checkout main
Setup the project
python -m venv .venv
source .venv/bin/activate
pip install -U pip
pip install -r requirements_dev.txt
pre-commit install
pre-commit autoupdate
pytest
Create a new branch
git fetch origin
git checkout -b task/branch-name-you-work-issue
Create a pull request to the branch main
Ultimate Django app for multi-tenant.
- Documentation: https://django-ultratenant.readthedocs.io.
Installation
pip install django-ultratenant
How to Use
- TODO
Alternatives
- https://github.com/django-tenants/django-tenants/ - only Postgres with multi-schema
- https://github.com/citusdata/django-multitenant - only Postgres (with Citus extension)
Base projects
MVP
-
setup and pip
-
SQLite3 support
-
multi-db
-
tenant on URL path
-
documetation about how customize manage.py
API
# settings.py
from ultratenant.multidb import Databases
...
MIDDLEWARE = [
...
'ultratenant.path.Middleware',
]
...
DATABASES = Databases(config('DATABASE_URL', cast=dburl))
DATABASE_ROUTERS = ['ultratenant.multidb.Router']
(maybe it won't be necessary)
# urls.py
...
from ultimate_tenants.urls import tenants_path
urlpatterns = tenants_path([
path('admin/', admin.site.urls),
path('', index, name='index'),
])
# url.com/tenant/admin
Roadmap
-
other databases supported by Django: PostgreSQL, MariaDB, MySQL, Oracle
-
multi-schema
-
tenant-id
-
custom [manage.py]{.title-ref} to access different tenants
-
cookiecutter to create a new project
Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
[Unreleased]
[0.0.1] - 2022-07-31
Added
- First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_ultratenant-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89ace975d42f7a1c6903846da21334e50e478102bbfb9a7eac3bf5cf8aefff58 |
|
MD5 | f3a7184b1ad9548ea86cf28c09eff554 |
|
BLAKE2b-256 | 44f85da848484e1ee1d4f6d6618eebb6d20225ca75e73613a490a119441f038c |