Divio Cloud offers Beta support for PostGIS/GeoDjango. To activate it, you will need to be using up-to-date versions of our software.

Contact support

Please contact support to enable PostGIS for your project.

Enable PostGIS in Django

Enable django.contrib.gis in the Aldryn Django Addon configuration.

Ensure that you have the requisite system libraries installed

GeoDjango requires the GDAL  library, which may or may not already be installed in your project's Docker environment (you will get a runtime error django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library  if it is not).

To install GDAL , edit your Dockerfile  and after the FROM  section, add: 

RUN apt-get update && apt-get install -y gdal-bin

Enable PostGIS locally

After completing the steps above, you need to set your local database to use the same engine as is used on the cloud platform.

Edit your docker-compose.yml  file to refer to mdillon/postgis - for example, change:

 image: postgres:9.6


 image: mdillon/postgis:9.6

(You are advised to keep the same version number.)

Did this answer your question?