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
  1. Crear modelos para cuentas y usuarios.
from tenantflow.models import AbstractAccount, AbstractUserAccount

class Account(AbstractAccount):
    extra_info = models.CharField(max_length=255)

class UserAccount(AbstractUserAccount):
    extra_info = models.CharField(max_length=255)
  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.1.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.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_tenantflow-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 38e6fbdfbb4d9766a4a20aa48b80cf52a13e461bced316219ab7b3eec9cccc6d
MD5 ec944d3e79e0f17ec7bb0bee96933d4d
BLAKE2b-256 16a4c9dc90279d7938dae516c1a105276e963a4b4f7f7af07a265191443fb825

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_tenantflow-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9bd62aac33f99be95ea051b55b22043a974f2389c8889bb64aba902b0542c6a1
MD5 84e523aab86cfdffd04858e44a68ff5c
BLAKE2b-256 c3a81d05e77b6575ea58fb399ed510d3b8316736271d39f807c56a5dfdae98c4

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