Bringing up GeoDjango + PostgreSQL on Karmic Ubuntu

26 views
Skip to first unread message

Davepar

unread,
Nov 1, 2009, 1:49:25 AM11/1/09
to geodjango
With each new release of Ubuntu, more and more packages get added
making it easier to get GeoDjango up and running. I'm trying to figure
out the list of packages and commands needed to get GeoDjango running
on PostgreSQL on the latest Karmic Koala release.

I listed the steps I'm using below. Unfortunately, it seems that the
"postgis" package is not enough to get the lwpostgis.sql and
spatial_ref_sys.sql scripts installed that are needed to set up the
template.

There is also a postgresql-8.3-postgis package, but the latest
PostgreSQL version is 8.4.

Anybody help appreciated,
Dave

Steps for installing GeoDjango and PostgreSQL/Postgis on Karmic Koala
Ubuntu:

For Django:
sudo apt-get install python-django

For PostgreSQL:
sudo apt-get install postgresql python-psycopg2

For GeoDjango:
sudo apt-get install postgis binutils libgdal1-1.5.0 gdal-bin
libgeos-3.1.0 proj libpq-dev

Set up Postgresql:
sudo su - postgres
createuser --createdb --superuser username
createdb -E UTF8 template_postgis # Creating the template spatial
database.
createlang -d template_postgis plpgsql # Adding PLPGSQL language
support.
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE
datname='template_postgis';" # Allows non-superusers the ability to
create from this template
psql -d template_postgis -f /usr/share/postgis/lwpostgis.sql # Loading
the PostGIS SQL routines
psql -d template_postgis -f /usr/share/postgis/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;"
exit
createdb -T template_postgis databasename

Adon Metcalfe

unread,
Nov 1, 2009, 2:10:29 AM11/1/09
to geod...@googlegroups.com
I ended up using postgresl-8.3-postgis, which works niceley with the geodjango debian creation template script, perhaps try installing that to get the postgis template database setup scripts? I'd be interested if you find a way, atm am keeping everything on 8.3 to be safe.
--
Adon Metcalfe
mobile: 0429 080 931

Davepar

unread,
Nov 1, 2009, 3:07:11 PM11/1/09
to geodjango
I ended up going back to PostgreSQL 8.3 as well. Actually, I re-
installed Karmic and then installed PostgreSQL 8.3. For some reason,
uninstalling 8.4 and then installing 8.3 didn't work.

I put the modified script on Pastebin in case it helps out anybody
else:
http://pastebin.com/f3f292e7b

It's very slick to be able to get GeoDjango up and running with just a
handful of commands. Takes about 10 minutes.

Dave
Reply all
Reply to author
Forward
0 new messages