Version 2 (modified by ikks, 8 years ago) (diff)

python2.5 on Lenny by default

These instructions apply for Debian Lenny and GeoDjango on django1.0 and postgresql-8.3

Packages Installation

Debian Lenny is shiped with the needed packages and defaults to python2.5

sudo apt-get install libgeos-3.0.0 proj postgis gdal-bin postgresql-8.3-postgis postgresql-8.3

Create a database template

This database could be used for recreating your geodjango powering databases

sudo su postgres createdb postgis_template
sudo su postgres createlang plpgsql postgis_template
sudo su postgres psql -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql postgis_template
sudo su postgres psql -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql postgis_template

Testing the configuration

Make sure the new libraries are on the path, eventually logoff and sign in again.

export DJANGO_SETTINGS_MODULE=myproject.settings
export GEOS_LIBRARY_PATH=/usr/lib

The following tests should run flawlessly.

>>> from django.contrib.gis.gdal import HAS_GDAL
>>> print HAS_GDAL # Will be False if GDAL libraries are not found
>>> from django.contrib.gis.tests import test_gdal
>>> from django.contrib.gis.tests import test_geos

Creating a database

Now when creating a new database, use postgis_template as template :)

sudo su postgres createdb -t postgis_template mynewdb


If you hit errors, please refer to GeoDjangoInstall

Back to Top