加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > MsSql教程 > 正文

我的PostGIS数据库看起来不错,但GeoDjango认为否则为什么?

发布时间:2020-12-12 06:23:56 所属栏目:MsSql教程 来源:网络整理
导读:我正在尝试设置一个GeoDjango应用程序来测试我正在使用的 an earlier problem.我设置了一个postgresql数据库,创建了一个新的Django项目和应用程序,但是当我尝试./manage.py syncdb我得到这个: django.core.exceptions.ImproperlyConfigured: Cannot determin
我正在尝试设置一个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读取版本信息.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读