ю
This commit is contained in:
@@ -26,24 +26,13 @@ Domain.objects.create(
|
|||||||
tenant=client,
|
tenant=client,
|
||||||
is_primary=True
|
is_primary=True
|
||||||
)
|
)
|
||||||
|
# Добавляем 127.0.0.1 как синоним localhost (иначе админка по 127.0.0.1 не будет работать)
|
||||||
|
Domain.objects.create(
|
||||||
|
domain='127.0.0.1',
|
||||||
|
tenant=client,
|
||||||
|
is_primary=False
|
||||||
|
)
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
# 5. Создаем суперпользователя для public схемы
|
# 5. Создаем суперпользователя для public схемы
|
||||||
python manage.py createsuperuser
|
python manage.py createsuperuser
|
||||||
|
|
||||||
# 6. Создаем суперпользователя для конкретного тенанта (опционально)
|
|
||||||
python manage.py shell
|
|
||||||
# Внутри:
|
|
||||||
from tenants.models import Client
|
|
||||||
from django.core.management import call_command
|
|
||||||
from django_tenants.utils import schema_context
|
|
||||||
|
|
||||||
client = Client.objects.get(schema_name='public')
|
|
||||||
with schema_context(client):
|
|
||||||
call_command('createsuperuser')
|
|
||||||
exit()
|
|
||||||
|
|
||||||
# 7. Восстановление стандартных ролей для конкретного тенанта
|
|
||||||
# Если роли были удалены или нужно их пересоздать:
|
|
||||||
python manage.py tenant_command init_roles --schema=anatol
|
|
||||||
# Где 'anatol' - имя схемы тенанта (schema_name)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user