[Fixed]-Django Tenant and Django Guardian configuration settings.py

1👍

SHARED_APPS = (
    #tenant requirements
    'tenant_schemas',
    'myapp.clients',
    'django.contrib.contenttypes',
    'django.contrib.staticfiles',
    'django.contrib.auth',
    'myapp.users',
    'guardian',
    'oauth2_provider',
    'rest_framework',
)

TENANT_APPS = (
    'django.contrib.contenttypes',
    'custom_user',
    'coopmsapi.users',
    'oauth2_provider',
    'corsheaders',
    'django.contrib.auth',
    'django.contrib.admin',
    'guardian',
    'django.contrib.staticfiles',
    'rest_framework',
    'myapp',
    'myapp.accounting',
    'myapp.budget',
    'myapp.enterprise',
    'myapp.payables',
    'myapp.receivables',
    'rest_framework_nested',
    'solo',
    'rest_framework_swagger',    
)

After multiple attempts this is what ended up working. I also had to perform migrations several migrations of the apps SHARED OR TENANT initially otherwise django-tenant won’t pick up automatically that it needs to create certain tables when it creates a new schema.

Leave a comment