使用django的postgis和多租户

问题描述 投票:0回答:1

我必须创建一个使用由国家分开的多租户的应用程序[即:colombia.myapp.com,usa.myapp.com等],我想在PostGIS中使用geoDjango模块。对于我的多租户我正在使用django-tenant-schemas,但这两种解决方案都改变了postgres数据库的引擎。

问题:有没有办法在django的同一个数据库中使用两个独立的引擎?或使用两个引擎连接到同一个数据库而不会在数据库中产生冲突并使用Multi Tenancy和GeoDjango?

django multi-tenant geodjango
1个回答
0
投票

是的,你可以,你只需要小心,始终指出你想要使用的数据库。

settings.朋友:

DATABASES = {
    'default': {},
    'users': {
        'NAME': 'user_data',
        'ENGINE': 'django.db.backends.mysql',
        'USER': 'mysql_user',
        'PASSWORD': 'superS3cret'
    },
    'customers': {
        'NAME': 'customer_data',
        'ENGINE': 'django.db.backends.mysql',
        'USER': 'mysql_cust',
        'PASSWORD': 'veryPriv@ate'
    }
}

https://docs.djangoproject.com/en/2.1/topics/db/multi-db/

© www.soinside.com 2019 - 2024. All rights reserved.