Skip to content
This repository has been archived by the owner on Apr 23, 2021. It is now read-only.

Installinggeodjango

gldnspud edited this page Nov 24, 2010 · 3 revisions

Creating a new "swdev" database supporting geodjango:

$ sudo aptitude install postgresql-8.4-postgis binutils libgdal1-1.6.0 proj gdal-bin python-gdal

$ sudo su - postgres
$ createdb -E UTF8 -T template0 template_postgis
$ createlang -d template_postgis plpgsql
$ psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';"
$ POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib
$ psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql # Loading the PostGIS SQL routines
$ psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql
$ psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" # Enabling users to alter spatial tables.
$ psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"

$ createdb -T template_postgis swdev

Upgrading an existing "swdev" database to geodjango:

$ sudo aptitude install postgresql-8.4-postgis binutils libgdal1-1.6.0 proj gdal-bin python-gdal

$ sudo su - postgres
$ createlang -d swdev plpgsql
$ POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib
$ psql -d swdev -f $POSTGIS_SQL_PATH/postgis.sql # Loading the PostGIS SQL routines
$ psql -d swdev -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql
$ psql -d swdev -c "GRANT ALL ON geometry_columns TO PUBLIC;" # Enabling users to alter spatial tables.
$ psql -d swdev -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
Clone this wiki locally