2015-03-31 107 views
0

所以我已经安装了多积累包我的构建包的HerokuHeroku的PostGIS的makemigrations错误GeoDjango内置

https://github.com/ddollar/heroku-buildpack-multi.git 

和我有.buildpacks文件

https://github.com/cyberdelia/heroku-geo-buildpack.git#1.3 
https://github.com/heroku/heroku-buildpack-python 

工程安装,但是当我运行python manage.py makemigrations我得到这个错误:

django.core.exceptions.ImproperlyConfigured: Cannot determine PostGIS version 
for database "d34ce1ddsg9nkp". GeoDjango requires at least PostGIS version 1.3. 
Was the database created from a spatial database template? 

我试过多种方式setti在settings.py中的数据库如:

 GEOS_LIBRARY_PATH = environ.get('GEOS_LIBRARY_PATH') 
     GDAL_LIBRARY_PATH = environ.get('GDAL_LIBRARY_PATH') 
and 
     GEOS_LIBRARY_PATH = "{}/libgeos_c.so".format(environ.get('GEOS_LIBRARY_PATH')) 
     GDAL_LIBRARY_PATH = "{}/libgdal.so".format(environ.get('GDAL_LIBRARY_PATH')) 

我在做什么错?

回答

1

好了,所以我解决了这个问题通过允许在Heroku上的PostGIS通过运行这些命令

heroku pg:psql 
create extension postgis; 

然后我跑到这个命令来查看我不得不在Heroku

SELECT PostGIS_full_version(); 

然后我就把这个是什么版本我的settings.py文件

POSTGIS_VERSION = (2, 1, 5) 

and viola it works!

+0

有史以来最好回答!谢谢!! – pateto777 2017-07-04 16:22:46