Enable postgis on heroku for django

$ heroku config:set BUILD_WITH_GEO_LIBRARIES=1

During your next build, these libraries will be downloaded and installed.

In your settings:

def DATABASES(self):
    db = dict(default=dj_database_url.config())
    db['default']['ENGINE'] = 'django.contrib.gis.db.backends.postgis'
    return db

GDAL_LIBRARY_PATH = env('GDAL_LIBRARY_PATH')
GEOS_LIBRARY_PATH = env('GEOS_LIBRARY_PATH')

This will ensure that Django can find the GEOS libraries that are installed.

Note: this will only work with Heroku's cedar-14 stack. Not with heroku-16 (which is newer), for this stack do:

$ heroku buildpacks:set https://github.com/dschep/heroku-geo-buildpack.git
$ heroku buildpacks:add heroku/python
$ heroku config:unset BUILD_WITH_GEO_LIBRARIES