Closed thiagoocortes closed 2 months ago
Hello I've just found what I was missing. Here is what I did:
SHARED_APPS = [ 'django_tenants', 'wagtail_tenants.customers', 'wagtail_tenants',
'taggit',
'modelcluster',
'wagtail',
"wagtail.users",
'wagtail.contrib.settings',
'wagtail.sites',
'wagtail.snippets',
'wagtail.locale',
'wagtail.contrib.forms',
'wagtail.admin',
'wagtail_modeladmin',
'wagtail.contrib.redirects',
'wagtail.embeds',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
"wagtail_tenants.users",
]
TENANT_APPS = [
'wagtail',
"wagtail.users",
'wagtail.contrib.settings',
'wagtail.sites',
'wagtail.snippets',
'wagtail.locale',
'wagtail.contrib.forms',
'wagtail.admin',
'wagtail_modeladmin',,
'wagtail.contrib.redirects',
'wagtail.embeds',
'wagtail.documents',
'wagtail.images',
'wagtail.search',
'courses',
]
INSTALLED_APPS = list(SHARED_APPS) + [ app for app in TENANT_APPS if app not in SHARED_APPS ]
Thanks guys
Hello I've just intalled wagtail_tenants.
Everything for subdomain tenants is working porperly, I've multi tenants sites for subdomain (eg. tenant1.localhost:8000).
But for the main domain (localhost:8000) I got "wagtailcore_site" does not exist and for wagtail admin page I got relation "wagtailcore_locale" does not exist.
Here is my configurations in settings:
SHARED_APPS = [ 'django_tenants', 'wagtail_tenants.customers', 'wagtail_tenants', 'taggit', 'modelcluster', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', "wagtail_tenants.users", "wagtail.users", ]
TENANT_APPS = [ 'wagtail', 'wagtail.contrib.settings', 'wagtail.sites', 'wagtail.snippets', 'wagtail.locale', 'wagtail.contrib.forms', 'wagtail.admin', 'wagtail_modeladmin', 'wagtail.contrib.redirects', 'wagtail.embeds', 'wagtail.documents', 'wagtail.images', 'wagtail.search', ]
INSTALLED_APPS = SHARED_APPS + TENANT_APPS
MIDDLEWARE = [ 'wagtail_tenants.middleware.main.WagtailTenantMainMiddleware', 'wagtail_tenants.middleware.main.WagtailTenantPermissionMiddleware', 'wagtail.contrib.redirects.middleware.RedirectMiddleware', 'django_tenants.middleware.main.TenantMainMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django_tenants.middleware.TenantMiddleware', ]
DATABASES = { 'default': { 'ENGINE': 'django_tenants.postgresql_backend', 'NAME': os.getenv('POSTGRES_DB'), 'USER': os.getenv('POSTGRES_USER'), 'PASSWORD': os.getenv('POSTGRES_PASSWORD'), 'HOST': 'localhost', 'PORT': '5432', } }
AUTH_USER_MODEL = 'wagtail_tenants.User' TENANT_MODEL = "customers.Client" TENANT_DOMAIN_MODEL = "customers.Domain" DEFAULT_AUTO_FIELD='django.db.models.AutoField'
DATABASE_ROUTERS = [ 'wagtail_tenants.routers.WagtailTenantSyncRouter', 'django_tenants.routers.TenantSyncRouter', ]
What am I missing?
Thank you in advance.