在django鼻子测试中安装hstore扩展 [英] Installing hstore extension in django nose tests

查看:291
本文介绍了在django鼻子测试中安装hstore扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功安装了hstore扩展程序,当我 syncdb 时,一切都可以正常工作。 (我正在使用 djorm-ext-hstore

I've installed the hstore extension successfully, and everything works when I syncdb. (I'm using djorm-ext-hstore)

但是,鼻子创建一个新的临时数据库来运行测试,并且没有安装hstore。

However, nose creates a new temp database to run tests in, and hstore is not installed in it.

我需要运行 CREATE EXTENSION HSTORE; 在测试db之前,鼻子同步数据库,但我找不到任何有关如何做的信息。

I need to run CREATE EXTENSION HSTORE; on the test db right before nose syncs the db, but I can't find any info on how to do that.

任何想法?

推荐答案

这是一个非问题:解决这个问题的最好方法是应用hstore默认数据库上的扩展名, template1

This is a non-issue: The best way to fix this is to apply the hstore extension on the default database, template1

psql -d template1 -c'创建扩展名hstore;'

参考:如何使用已安装hstore扩展名创建新数据库?

这篇关于在django鼻子测试中安装hstore扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆