...
Code Block |
---|
createdb -E UTF-8 --locale=en_US.UTF-8 template_postgis -T template0 createlang plpgsql template_postgis psql -d template_postgis -c "UPDATE pg_database SET datistemplate=true WHERE datname='template_postgis'" psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/postgis.sql psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/spatial_ref_sys.sql psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/postgis_comments.sql |
Exit the postgres user:
Code Block |
---|
exit
exit
|
Note: in these instructions, the template name is template_postgis
You can choose any template name you like, but you will need to use your particular template name where appropriate when creating a database from the template.
Grant necessary permissions to new tables
Note |
---|
I'm not yet sure if this step can be done here, or if it has to be done after the database is created from the template. |
Some of the table created by PostGIS do not have correct permissions for your user. To grant these permissions:
Code Block |
---|
psql oercommons_db
GRANT SELECT ON geometry_columns TO oercommons_user;
GRANT DELETE ON geometry_columns TO oercommons_user;
GRANT INSERT ON geometry_columns TO oercommons_user;
GRANT SELECT ON spatial_ref_sys TO oercommons_user;
\q
|
Note that these commands assume your database user is oercommons_user
. If you are using a different user name (as specified in your project/development.py
file), you'll have to adjust these commands accordingly.
Exit the postgres user:
Code Block |
---|
exit
exit
|
Update development.py
In your project/development.py
file, update the "ENGINE" of your default database definition:
...