Deploy an Application Including the GDAL Library

The GDAL library is often used in application needing to manipulate geospatial data. This page describes the steps to deploy an application on Scalingo which makes use of the GDAL library.

Install GDAL on a Scalingo Application

To install the GDAL library on a Scalingo application, you need to make use of the APT buildpack. Such a buildpack should be used as part of a multi-buildpack. For instance, if your application is developed using the Python programming language:

$ echo '' > .buildpacks
$ echo '' >> .buildpacks
$ git add .buildpacks
$ git commit -m 'Add multi-buildpack'

You need to instruct the APT buildpack to install the GDAL library. Create a Aptfile at the root of your project with the following content:


Last, set the following environment variables on your application:


Deploy your application, it is ready to use the GDAL library!

GDAL with Django

The GDAL library won’t be accessible during the build so the django collectstatic step will fail. A solution is to disable the collectstatic feature during the build with the following environment variable:


Then you will be able to trigger the collectstatic after the build by creating a post_compile script like this:


export PYTHONPATH=/build/${REQUEST_ID}/.apt/usr/lib/python3/dist-packages/:{PYTHONPATH}
export LD_LIBRARY_PATH=/build/${REQUEST_ID}/.apt/usr/lib/x86_64-linux-gnu/blas/:/build/${REQUEST_ID}/.apt/usr/lib/x86_64-linux-gnu/lapack/:${LD_LIBRARY_PATH}
export PROJ_LIB=/build/${REQUEST_ID}/.apt/usr/share/proj

python collectstatic --noinput

Suggest edits

Deploy an Application Including the GDAL Library

©2024 Scalingo