根据我所看到的,解决方案是运行create extension hstore。然而,当我尝试运行一个django测试时,我得到了错误django.db.utils.ProgrammingError: type "hstore" does not exist,即python manage.py当我用\dx检查测试数据库有哪些扩展可用时,我发现它没有hstore。如果我运行create extension hstore,就会创建hstore扩展。
在运行django测试之前,我正在尝试安装hstore扩展。为此,我重写了默认的DiscoverRunner's setup_databases方法。但是,没有安装扩展&测试显示了这个错误django.db.utils.ProgrammingError: type "hstore" does not exist。DEFAULT_DB_ALIAS] cursor.execute('CREATE EXTENS
但当我进行测试时,我遇到了一个问题:根据我的发现,问题在于Postgres,所以我尝试在psql中运行以下命令:create extension hstore;在template1数据库上。扩展现在显示为清单扩展(\dx):
hstore | 1.5 | public | data type for storing sets of (key, value) p