gpt4 book ai didi

python - Django-tenant-schemas 和 GeoDjango 一起

转载 作者:太空宇宙 更新时间:2023-11-03 14:35:03 26 4
gpt4 key购买 nike

我想使用django-tenant-schemasGeoDjango (PostGIS)在我的 Django 项目中。我有一个默认数据库。但 django-tenant-schemas 和 GeoDjango 都希望我在设置中为数据库设置一个自定义引擎。

django-tenant-schemas 希望将其设置为 tenant_schemas.postgresql_backend
而 GeoDjango 希望将其设置为 django.contrib.gis.db.backends.postgis 。

这个问题有解决办法吗?

编辑:我只想将 GeoDjango 用于单个模型,并且我使用单个 Postgres 数据库。

最佳答案

我解决这个问题的方法是更改​​tenant_schame.postgresql_backend.base中的ORIGINAL_BACKEND。我把它改为

ORIGINAL_BACKEND = getattr(settings, 'ORIGINAL_BACKEND', 'django.contrib.gis.db.backends.postgis')

来自

ORIGINAL_BACKEND = getattr(settings, 'ORIGINAL_BACKEND', 'django.db.backends.postgresql_psycopg2')

关于python - Django-tenant-schemas 和 GeoDjango 一起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47016787/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com