forked from open-city/councilmatic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,41 @@ | ||
#!/bin/sh | ||
|
||
# libevent development files are required for gevent | ||
sudo apt-get install libevent-dev | ||
apt-get install libevent-dev | ||
|
||
# Install GeoDjango dependencies -- see | ||
# https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#ubuntu | ||
apt-get install binutils gdal-bin libproj-dev postgresql-9.1-postgis \ | ||
postgresql-server-dev-9.1 python-psycopg2 | ||
|
||
virtualenv .env | ||
source .env/bin/activate | ||
|
||
echo "Install the python requirements" | ||
pip install -r requirements.txt | ||
|
||
echo "Install the non-python requirements" | ||
apt-get install poppler-utils | ||
|
||
echo "... and this, optional testing stuff" | ||
pip install coverage | ||
|
||
# Create a PostGIS template database | ||
psql -c "CREATE DATABASE template_postgis;" -U postgres | ||
psql -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';" -U postgres | ||
createlang plpgsql template_postgis -U postgres | ||
# Loading the PostGIS SQL routines | ||
psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql -q | ||
psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql -q | ||
# Enabling users to alter spatial tables. | ||
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" | ||
psql -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;" | ||
|
||
psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';" | ||
POSTGIS_SQL_PATH=`pg_config --sharedir`/contrib/postgis-1.5 | ||
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 councilmatic | ||
|
||
echo "Create the database" | ||
psql -U postgres <<EOF | ||
CREATE USER councilmatic WITH PASSWORD 'councilmatic'; | ||
CREATE DATABASE councilmatic WITH TEMPLATE = template_postgis; | ||
GRANT ALL ON DATABASE template_postgis TO councilmatic; | ||
GRANT ALL ON DATABASE councilmatic TO councilmatic; | ||
ALTER USER councilmatic WITH CREATEDB; | ||
EOF | ||
echo "Initialize the project settings" | ||
cp councilmatic/local_settings.py.template councilmatic/local_settings.py | ||
exit #to return to your normal user | ||
----------------------------------- | ||
cp councilmatic/oakland_local_settings.py.template councilmatic/local_settings.py |