dan*_*roa 8 django heroku geodjango
我在Heroku上收到以下错误:
django.core.exceptions.ImproperlyConfigured: Could not import user-defined GEOMETRY_BACKEND "geos".
Run Code Online (Sandbox Code Playgroud)
这很奇怪,因为它之前有效.
我将buildpack设置为https://github.com/dulaccc/heroku-buildpack-geodjango/.
在我的settings.py中,我有:
GEOS_LIBRARY_PATH = environ.get('GEOS_LIBRARY_PATH')
GDAL_LIBRARY_PATH = environ.get('GDAL_LIBRARY_PATH')
Run Code Online (Sandbox Code Playgroud)
当我部署到Heroku时,它似乎找到了GEOS.这是日志:
-----> Checking for GEOS
Installed
GEOS installed and accessible with env variable 'GEOS_LIBRARY_PATH'
-----> Checking for Proj.4
Installed
Proj.4 installed and accessible with env variable 'PROJ4_LIBRARY_PATH'
-----> Checking for GDAL
Installed
GDAL installed and accessible with env variable 'GDAL_LIBRARY_PATH'
Run Code Online (Sandbox Code Playgroud)
我刚刚遇到了完全相同的错误,但我正在使用 ddollar https://github.com/ddollar/heroku-buildpack-multi的多 buildpack 方法,该方法直到今天早上都一直运行良好。
$ heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
$ cat .buildpacks
# .buildpacks
https://github.com/cyberdelia/heroku-geo-buildpack.git
https://github.com/heroku/heroku-buildpack-python
Run Code Online (Sandbox Code Playgroud)
正如你所说,它似乎找到/安装了 geos 和 gdal 库,但 django 没有。这是因为 django 需要文档中的完整路径:
https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/geolibs/
因此,就我而言,我在 settings.py 中添加了以下内容:
GEOS_LIBRARY_PATH = "{}/libgeos_c.so".format(environ.get('GEOS_LIBRARY_PATH'))
GDAL_LIBRARY_PATH = "{}/libgdal.so".format(environ.get('GDAL_LIBRARY_PATH'))
Run Code Online (Sandbox Code Playgroud)
现在一切又好了。
归档时间: |
|
查看次数: |
3188 次 |
最近记录: |