gpt4 book ai didi

Heroku:django.core.exceptions.ImproperlyConfigured:找不到 GDAL

转载 作者:行者123 更新时间:2023-12-05 07:35:44 27 4
gpt4 key购买 nike

我正在尝试在 heroku 上运行 geodjango 应用程序,我添加了一个构建包以使 gdal 可用

https://github.com/cyberdelia/heroku-geo-buildpack.git .在推送期间,它说 gdal 和其他 geotools 已成功安装

remote: -----> geos/gdal/proj app detected
remote: Using geos version: 3.6.1
remote: Using gdal version: 2.1.3
remote: Using proj version: 4.9.3
remote: -----> Vendoring geo libraries done
remote: -----> Python app detected
remote: ! The latest version of Python 3 is python-3.6.4 (you are using python-3.6.2, which is unsupported).
remote: ! We recommend upgrading by specifying the latest version (python-3.6.4).
remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing requirements with pip
remote:
remote: -----> $ python manage.py collectstatic --noinput
remote: 1018 static files copied to '/tmp/build_2e0a13e9519778105269a34/test/staticfiles', 1158 post-processed.
remote:
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing...
remote: Done: 235.8M
remote: -----> Launching...
remote: Released v60
remote: https://test.herokuapp.com deployed to Heroku
remote:
remote: Verifying deploy... done.

当我请求页面时,它说应用程序错误。

来自 heroku 日志

2018-03-19T14:25:00.614100+00:00 app[web.1]:     from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
2018-03-19T14:25:00.614103+00:00 app[web.1]: from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
2018-03-19T14:25:00.614104+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/gis/gdal/libgdal.py", line 43, in <module>
2018-03-19T14:25:00.614106+00:00 app[web.1]: % '", "'.join(lib_names)
2018-03-19T14:25:00.614813+00:00 app[web.1]: [2018-03-19 14:25:00 +0000] [9] [INFO] Worker exiting (pid: 9)
2018-03-19T14:25:00.746744+00:00 app[web.1]: [2018-03-19 14:25:00 +0000] [4] [INFO] Shutting down: Master
2018-03-19T14:25:00.746839+00:00 app[web.1]: [2018-03-19 14:25:00 +0000] [4] [INFO] Reason: Worker failed to boot.
2018-03-19T14:25:00.614110+00:00 app[web.1]: django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal2.2.0", "gdal2.1.0", "gdal2.0.0", "gdal1.11.0", "gdal1.10.0", "gdal1.9.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.>

我应该在设置中指定一些路径还是我使用的是不兼容的版本? (我正在使用 Django==2.0.2)

最佳答案

来自 Heroku's docs ,将以下内容添加到您的 settings.py 中:

import dj_database_url
DATABASES['default'] = dj_database_url.config()
DATABASES['default']['ENGINE'] = 'django.contrib.gis.db.backends.postgis'

GDAL_LIBRARY_PATH = os.getenv('GDAL_LIBRARY_PATH')
GEOS_LIBRARY_PATH = os.getenv('GEOS_LIBRARY_PATH')

关于Heroku:django.core.exceptions.ImproperlyConfigured:找不到 GDAL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49365510/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com