【问题标题】:Error using Django-Hstore for PostgreSQL HSTORE in Django在 Django 中为 PostgreSQL HSTORE 使用 Django-Hstore 时出错
【发布时间】:2016-12-08 15:11:54
【问题描述】:

当我运行我的 Django 服务器时,我得到了这个错误:

    class HStoreDescriptor(models.fields.subclassing.Creator):
AttributeError: 'module' object has no attribute 'subclassing'

我正在使用当前最新的 Django 1.10 和 django-hstore 1.4.2

【问题讨论】:

    标签: python django postgresql hstore django-hstore


    【解决方案1】:

    您不需要在 1.10 上使用 Django_Hstore 扩展。

    在您的 INSTALLED_APPS 中添加“django.contrib.postgres”。

    如果 Postgres 上没有启用 hstrone,请运行 sql 脚本:CREATE EXTENSION IF NOT EXISTS hstore

    型号: 地址:from django.contrib.postgres.fields import HStoreField

    添加字段:data = HStoreField()

    For More İnformation :

    【讨论】:

    • 谢谢,这对 Django 1.11 也有帮助
    【解决方案2】:

    这个问题可以通过将 Django 降级到 1.9 版本轻松解决。看来1.10版本还不稳定。

    pip install Django==1.9
    

    【讨论】:

      猜你喜欢
      • 2020-01-16
      • 1970-01-01
      • 1970-01-01
      • 2015-06-15
      • 2016-12-16
      • 1970-01-01
      • 1970-01-01
      • 2018-08-16
      • 2016-01-06
      相关资源
      最近更新 更多