我正在尝试设置一个GeoDjango应用程序来测试我正在使用的
an earlier problem.我设置了一个postgresql数据库,创建了一个新的Django项目和应用程序,但是当我尝试./manage.py syncdb我得到这个:
django.core.exceptions.ImproperlyConfigured: Cannot determine PostGIS version for database “django_geotest”. GeoDjango requires at least PostGIS version 1.3. Was the database created from a spatial database template?
我以前不了解GeoDjango的所有要求,并通过以下方式创建了django_geotest数据库:
$createdb -T template_postgis django_geotest
数据库看起来像是正确设置:
django_geotest=# SELECT PostGIS_full_version(); postgis_full_version ------------------------------------------------------------------------------------------------------- POSTGIS="1.5.3" GEOS="3.2.2-CAPI-1.6.2" PROJ="Rel. 4.7.1,23 September 2009" LIBXML="2.7.3" USE_STATS (1 row)
描述数据库,我得到这个:
django_geotest=# \d List of relations Schema | Name | Type | Owner --------+-------------------+-------+------- public | geography_columns | view | phil public | geometry_columns | table | phil public | spatial_ref_sys | table | phil (3 rows)
所以现在我被困在下一步要尝试…我对Postgresql及其模板等的了解并不是那么好.有任何想法吗?谢谢.
解决方法
与PostgreSQL 9.3和PostGIS 2.1安装在OS X 10.9.1上使用自制软件同样的问题.
对于这个特殊问题,您只需要添加以下行:
POSTGIS_VERSION = ( 2,1 )
使用逗号分隔号码将您的PostGIS版本设置为settings.py.
我不知道为什么,但Django无法从PostGIS读取版本信息.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。