A lib to help in the creation of shared schema multi tenants applications without suffering
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.github
docs
exampleproject
shared_schema_tenants
shared_schema_tenants_custom_data
tests
.coveragerc
.editorconfig
.gitignore
.travis.yml
AUTHORS.rst
CONTRIBUTING.rst
HISTORY.rst
LICENSE
MANIFEST.in
Makefile
README.rst
manage.py
requirements.txt
requirements_dev.txt
requirements_test.txt
runtests.py
setup.cfg
setup.py
tox.ini

README.rst

Django Shared Schema Tenants

https://travis-ci.org/hugobessa/django-shared-schema-tenants.svg?branch=master

A lib to help in the creation applications with shared schema without suffering

Documentation

The full documentation is at [ReadTheDocs](https://django-shared-schema-tenants.readthedocs.io).

Quickstart

Install Django Shared Schema Tenants:

pip install django-shared-schema-tenants

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'shared_schema_tenants.apps.SharedSchemaTenantsConfig',
    ...
)

Add Django Shared Schema Tenants's URL patterns:

from shared_schema_tenants import urls as shared_schema_tenants_urls


urlpatterns = [
    ...
    url(r'^', include(shared_schema_tenants_urls)),
    ...
]

Add TenantMiddleware to your MIDDLEWARES:

MIDDLEWARES = [
    # ...
    'shared_schema_tenants.middleware.TenantMiddleware',
    # ...
]

Features

  • Tenants synced with django requests: The active tenant can be extracted from the domain of the request and from a specific http header attribute.
  • Easy data isolation between tenants: You retrieve and create data the same way you do without tenants. The active tenant can be retrieved from the request, and can also be forcedly set.
  • Partially shared data: If there is data that can be accessed from more then one tenant in your applidation, you don't need to duplicate it.

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Credits

Tools used in rendering this package: