现在在django1.9中pre_syncb
已经被删除了,有没有一个信号可以像下面的代码那样工作?地址:
@receiver(pre_syncdb, sender=sys.modules[__name__])
def setup_postgres_hstore(sender, **kwargs):
"""
Always create PostgreSQL HSTORE extension if it doesn't already exist
on the database before syncing the database.
Requires PostgreSQL 9.1 or newer.
"""
cursor = connection.cursor()
cursor.execute("CREATE EXTENSION IF NOT EXISTS hstore")
我知道我可以很容易地运行SQL查询,但是如果可能的话,我想知道上面发布的代码的任何确切替代方法。你知道吗
来自pre_syncdb的文档
所以你可以用that
相关问题 更多 >
编程相关推荐