circleci-images
circleci-images copied to clipboard
Docker for GeoDjango with PostGIS and SpatiaLite
CCI base Python image does not support GDAL library with the error django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library
- a user found that this image worked for them: https://github.com/wooyek/docker-geodjango
https://hub.docker.com/r/wooyek/geodjango/dockerfile
Hi,
What's the specific requests here? Are you suggesting we add a lib to our images or to add an image?
It seems that Django, when calling upon 'django.contrib.gis'
to use in the application, fails to properly locate GDAL installed in the image.
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.
I don't believe that any of the Python images install PostGIS, but certain circleci/postgres
images do (those with postgis
in the title.) Although they install gdal-dev and gdal, django.contrib.gis
looks for GDAL's library.
I managed to get it to work by installing libgdal-dev atop of CircleCI's PostgreSQL PostGIS image, but it does add a considerable amount of disk space (under install additional gdal dependencies).
In short, installing libgdal-dev
in PostGIS-enabled images would make it easier to run Django apps without fuss, but would considerably bloat the image size. The workaround is to install libgdal-dev
before calling the application.
@felicianotech It would be nice to have image: circleci/python:3.7.1-gdal
Currently I've made workaround with:
- run:
name: Install dependencies
command: |
sudo apt update
sudo apt install -y gdal-bin
pipenv sync --dev