Skip to main content

A Django library to enable semi-isolated multitenancy in your project with users outside the tenant.

Project description

Configuración de Django Multitenant

  1. Instalación de Django y creación de proyecto y app.
pip install django
django-admin startproject myproject
python manage.py startapp baseapp
cd myproject
  1. Instalación de django-tenantflow.
pip install django-tenantflow
  1. Configuración de la aplicación.
INSTALLED_APPS = [
    ...
    'tenantflow',
    'baseapp',
    ...
]
  1. Agregar el middleware de tenantflow.
MIDDLEWARE = [
    ...
    'tenantflow.middleware.TenantMiddleware',
    ...
]
  1. Configuraciones de la librería.
TENANTFLOW_DEFAULT_SCHEMA = 'public'  # Esquema predeterminado
TENANTFLOW_VALIDATION = True         # Habilitar validación de acceso al tenant
TENANTFLOW_SWITCH_METHOD = 'session' # Métodos disponibles: session, subdomain, header
TENANTFLOW_ACCOUNT_MODEL = "baseapp.Account" # Modelo de cuenta
  1. Crear modelos para cuentas y usuarios.
from tenantflow.models import AbstractAccount, AbstractUserAccount

class Account(AbstractAccount):
    pass

class UserAccount(AbstractUserAccount):
    account = models.ForeignKey(Account, on_delete=models.CASCADE)
  1. Aplicar migraciones al esquema público.
python manage.py makemigrations
python manage.py migrate

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_tenantflow-1.0.9.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_tenantflow-1.0.9-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file django_tenantflow-1.0.9.tar.gz.

File metadata

  • Download URL: django_tenantflow-1.0.9.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for django_tenantflow-1.0.9.tar.gz
Algorithm Hash digest
SHA256 ea3544750072802f79263cd72e6a8c04b25b05c3b6ea82f92807b57f4534a90c
MD5 94ed8ace8ad48b6525de66c83ad26e1c
BLAKE2b-256 7e578eedad69b6410ffb91b10e458b5f4975b5e36e651e4a57579bf0aca522fe

See more details on using hashes here.

File details

Details for the file django_tenantflow-1.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for django_tenantflow-1.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a414ef5a4bd2886e76e7e266f22d88be30f386bf0f2e3a7cf114b536c71f13c9
MD5 a63efa674c53c72c8de4c6b2aedcf5c7
BLAKE2b-256 abd187516097526db9bbc56a5553034a489c0c8169069b178cb2e2d915cef7ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page