circleci-images icon indicating copy to clipboard operation
circleci-images copied to clipboard

Docker for GeoDjango with PostGIS and SpatiaLite

Open jkzilla opened this issue 6 years ago • 3 comments

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

jkzilla avatar Feb 14 '19 18:02 jkzilla

Hi,

What's the specific requests here? Are you suggesting we add a lib to our images or to add an image?

FelicianoTech avatar Mar 13 '19 13:03 FelicianoTech

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.

mcab avatar Mar 25 '19 05:03 mcab

@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

Alexander3 avatar Apr 20 '19 13:04 Alexander3