Setup your GeoDjango application

The Django framework integrates extensions to handle geospatial data. To setup an application which is using such extensions, a bit of work is required:

  • PostgreSQL with postgis extension
  • Geospatial Libraries

Enable PostgreSQL ‘postgis’ extension

Scalingo PostgreSQL includes several extensions. Postgis the extension to handle geospatial data is among them. To use it with your application, your need to enable it.

$ scalingo -a appname pgsql-console
> CREATE EXTENSION postgis;

Then the database is ready, next step is to install the libraries django requires to manipulate these data.

Install Geospatial libraries

These libraries are proj, geos and gdal. Considered that they are not used commonly, they are not included in our default environment so you need to install them at deployment time.

Usage of the geo-buildpack

To deploy an application with these libraries you need to use an additional the default python buildpack.

Reminder, a buildpack is a piece of software able to detect and install dependencies of a given technology. More information about Scalingo's buildpacks.

Create a .buildpacks file at the root of your project with the following content:

https://github.com/Scalingo/geo-buildpack
https://github.com/Scalingo/python-buildpack

Then setup the multi buildpack for your project to handle this file:

scalingo env-set BUILDPACK_URL=https://github.com/Scalingo/multi-buildpack

Deploy your application

git add .buildpacks
git commit -m "Use geo-buildpack as long as python-buildpack"
git push scalingo master

Then you’ll see in your deployment output:

=====> Downloading Buildpack: https://github.com/Scalingo/geo-buildpack.git
=====> Detected Framework: geos/gdal/proj
       Using geos version: 3.4.2
       Using gdal version: 1.11.1
       Using proj version: 4.8.0_1
       ...
schedule 19 Nov 2015