GeoDjango: 'No such file or directory' when creating PostGIS spatial database template

734 Views Asked by At

I am working on MacOS Lion. I have successfully set up the KyngChaos libraries for Postgres and PostGIS, as per the official instructions with no problems.

I've reached the section on creating a spatial database template, and now I'm hitting a problem:

$ psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql
/postgis.sql: No such file or directory

How can I debug this? Where does postgis.sql come from in the first place?

UPDATE:

I just made sure that POSTGIS_SQL_PATH was actually set, as follows:

$ POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-1.5
$ echo $POSTGIS_SQL_PATH
/usr/local/Cellar/postgresql/9.1.3/share/postgresql/contrib/postgis-1.5
$ psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql
/usr/local/Cellar/postgresql/9.1.3/share/postgresql/contrib/postgis-1.5/postgis.sql: No such file or directory

It looks as though /usr/local/Cellar/postgresql/9.1.3/share/postgresql/ exists but there is no contrib directory below it. Where does this come from?

1

There are 1 best solutions below

0
On

It seems like you are not finding postgis. Start by searching for postgis.sql. If it is not found then install postgis. If it is found then set your path appropriately.