【问题标题】:Django-tenant-schemas and GeoDjango togetherDjango-tenant-schemas 和 GeoDjango 在一起
【发布时间】:2018-04-11 12:33:42
【问题描述】:

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

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

这个问题有什么解决方法吗?

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

【问题讨论】:

    标签: python django postgis geodjango


    【解决方案1】:

    我解决这个问题的方法是更改​​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')
    

    【讨论】:

      猜你喜欢
      • 2017-04-22
      • 1970-01-01
      • 2020-08-01
      • 2016-05-10
      • 1970-01-01
      • 2016-10-21
      • 1970-01-01
      • 2020-06-01
      • 2015-09-01
      相关资源
      最近更新 更多