$ su - postgres
$ createdb -E UTF8 template_postgis
$ createlang -d template_postgis plpgsql
$ psql -d template_postgis -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql
$ psql -d template_postgis -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql
$ psql -d template_postgis
template_postgis=# GRANT ALL ON geometry_columns TO PUBLIC;
template_postgis=# GRANT ALL ON spatial_ref_sys TO PUBLIC;
Djangoアプリケーションで利用するデータベースの作成
$ createuser djangobook
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) y
Shall the new role be allowed to create more new roles? (y/n) n
$ createdb -U postgres -O djangobook -T template_postgis manoush
Postgresql pg_hba.conf設定
$ cd /path/to/project
$ python manage.py syncdb
_cursor
self.connection = Database.connect(**conn_params)
psycopg2.OperationalError: FATAL: Ident authentication failed for user "djangobook"
//エラー発生
//PostgreSQLの設定ファイルを編集
# vi /etc/postgresql/8.3/main/postgresql.conf
---#listen_addresses = ‘localhost’
+++listen_addresses = ‘*'
# vi pg_hba.conf
記述要調査
# /etc/init.d/postgresql-8.3 restart