【问题标题】:heroku postgis makemigrations error geodjangoheroku postgis makemigrations 错误 geodjango
【发布时间】:2015-06-05 03:59:40
【问题描述】:

所以我为 heroku 的构建包安装了多个构建包

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?

我尝试了多种在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'))

我做错了什么?

【问题讨论】:

    标签: python django heroku geodjango buildpack


    【解决方案1】:

    好的,我通过运行这些命令在 heroku 上启用 postgis 解决了这个问题

    heroku pg:psql
    create extension postgis;
    

    然后我运行这个命令来查看我在 heroku 上的版本

    SELECT PostGIS_full_version();
    

    然后我把这是我的 settings.py 文件

    POSTGIS_VERSION = (2, 1, 5)
    

    和中提琴它的工作原理!

    【讨论】:

    • 有史以来最好的答案!谢谢!!
    猜你喜欢
    • 2016-10-20
    • 1970-01-01
    • 2013-05-22
    • 1970-01-01
    • 1970-01-01
    • 2020-04-07
    • 2021-05-07
    • 2021-06-15
    • 1970-01-01
    相关资源
    最近更新 更多