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.5.tar.gz (5.5 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.5-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_tenantflow-1.0.5.tar.gz
  • Upload date:
  • Size: 5.5 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.5.tar.gz
Algorithm Hash digest
SHA256 1e55ceb014088d6660aa875cdd889236a0ad5d11df72c88efc9dc30f37d836a7
MD5 01dd39e0acc22c76b2fa94089dd27e22
BLAKE2b-256 a8563fd6f3a5ac7555209b4bfd9eefeeff9cc7ab5c9789f5dacac2f0a17b2961

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_tenantflow-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0bcd01ccddd5a502799e7e0e3609878788571ac9dbe3de3a16cdae3d5010a595
MD5 2770554d0ddad0ce80be980dc6e44ae1
BLAKE2b-256 c62862994e5cd50b7759210d43e7276f3c53fe46455bdc62bb3c9d140fe04ac6

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