Django-tenants TypeError: argument of type 'TenantQueryset' is not iterable

i've made a system for hotels , i want to give it to several hotels with the same base code , i have used django-tenant-schemas and this is my SHARED_APP and TENANT_APP but when i try python manage. py migrate_schemas --shared it only creates my shared apps list and when i try either manage.py migrate_schemas --tenant or manage.py migrate_schemas it raise this error

if public_schema_name in tenants: TypeError: argument of type 'TenantQueryset' is not iterable

это мой settings.py

SHARED_APPS = [
    'tenant_schemas',
    'users',
    'rosetta',
    'widget_tweaks',
    'import_export',

    'django.contrib.contenttypes',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

TENANT_APPS = [
    'rooms',
    'vistors',
    'booking',
    'costs',
    'payments',
    'cancel',
]

INSTALLED_APPS = list(SHARED_APPS) + [app for app in TENANT_APPS if app not in SHARED_APPS]
TENANT_MODEL= "rooms.Hotel"

#db engine 
'ENGINE': 'tenant_schemas.postgresql_backend',

my models.py

class Hotel(TenantMixin):
    hotel_name = models.CharField(max_length=40,unique=True)
    def __str__(self):
        return self.hotel_name

class Room(models.Model):
    room_no = models.IntegerField()
    #others 

and i have more models but all of them inherited from models.Model ,in the public schema it only created tables for SHARED_APP apps , TENANT_APP not created django version 2.2 db : postgresql is there something else i have to change or is'nt there another way to achieve that please

Вы неправильно настроили django tenant Вот несколько исправлений

  1. В файле settings.py должны быть только приложения shared и tenant... А установленное приложение состоит из общего и приложения арендатора
  2. .
  3. В ваших приложениях арендатора нет некоторых важных приложений, таких как типы контента...

Должны быть и другие ошибки, поэтому я думаю, что вам следует просмотреть эти:

  1. Только что проверил ваш settings.py. Вы можете посмотреть это видео (https://youtu.be/QU70PbJuAUo)
  2. .
  3. В ваших приложениях арендатора не хватает некоторых жизненно важных приложений, которые вы можете посмотреть здесь https://github.com/Academy-Omen/saasy-blog
  4. .

Также убедитесь, что вы можете успешно подключить ваш проект к базе данных PostgresSQL перед установкой django tenant.

Вернуться на верх