问题描述
我正试图在全新的Django应用程式上进行测试。它必须运行几何测试。我的Postgres安装在Postgres.app(与Postgis 2),我的默认数据库运行很好(Django应用程序同步,创建等没有问题),但是当我运行
I am trying to enable testing on a brand new Django app. It has to run geometry tests. My Postgres installation in Postgres.app (with Postgis 2), my default database runs just fine (no problems with Django app syncing, creating, etc), but when I run
manage.py test
我收到错误: p>
I get an error:
完全错误:
我知道Django创建了一个Postgres DB进行测试。我怀疑它没有正确启用测试DB上的PostGIS扩展。
I know that Django creates a Postgres DB for testing. I'm suspecting that it does not correctly enable the PostGIS extension(s) on the test DB.
非常感谢任何人可以帮助我进行测试。 >
Much appreciated if anyone here can help me get testing.
推荐答案
提出问题是回答...
Asking the question is answering it ...
我研究了Django来源,并看到它测试存在 template_postgis
。如果发现,它适用于Postgis< 2.0。如果没有找到,它适用于Postgis> = 2。
I looked into the Django source, and saw it tests for the existence of template_postgis
. If found, it works for Postgis < 2.0. If not found, it works for Postgis >= 2.
而且,我的数据库中存在一个遗迹template_postgis。我重命名它(只是保持它,直到我确定我不需要它为其他项目),测试工作正常。
And lo and behold, a relic template_postgis was present in my DB. I renamed it (just keeping it until I'm sure I don't need it for some other project), and the test worked fine.
这篇关于使用PostGIS数据库测试GeoDjango应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!