Obsolete See the main README file
Basically:
- Install Python
- Install Postgres
- Make a Virtualenv and install requirements
- Initialize a Postgres database for the project
Download installer from https://www.python.org/downloads/release/python-343/
OR
Install using Homebrew:
brew install python3
Note: Whichver of the above you chose, you may need to upgrade virtualenvwrapper.
sudo pip install virtualenvwrapper --upgrade
Download and run installer for Mac OS X Version 9.3.9
http://www.enterprisedb.com/products-services-training/pgdownload
Default installation directory = /Library/PostgreSQL/9.3
Default data directory /Library/PostgreSQL/9.3/data
Default Port = 5432
Use default locale
Add the PostgreSQL bin directory to your PATH environment variable:
PATH=$PATH:/Library/PostgreSQL/9.3/bin
You may need to add the PostgreSQL lib directory to your DYLD_FALLBACK_LIBRARY_PATH environment variable:
DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH:/Library/PostgreSQL/9.3/lib
or
Install using Homebrew:
brew install postgres --with-python
(I installed Postgres with homebrew a long time ago, so can't verify this exact command.)
Create the cityhallmonitor
database and cityhallmonitor
user by executing the initdb.sh
script.
$ ./initdb.sh
This script assumes you've created a Postgres admin user with the same username as your shell login. If that's not the case, use this form instead:
$ PGUSER="postgres" ./initdb.sh
If your Postgres admin user has a different name, change the value of PGUSER
.
This script doesn't always work. You can do it manually:
$ createdb -U postgres cityhallmonitor
$ psql -U postgres cityhallmonitor
cityhallmonitor=# CREATE USER cityhallmonitor WITH PASSWORD 'default';
cityhallmonitor=# GRANT ALL PRIVILEGES ON DATABASE "cityhallmonitor" to cityhallmonitor;
cityhallmonitor=# \q
Verify you can connect to database as cityhallmonitor user:
$ psql -U cityhallmonitor cityhallmonitor
Make virtual environment and install requirements:
$ mkvirtualenv --python=/usr/local/bin/python3 cityhallmonitor
$ pip install -r requirements.txt
Create database tables:
python manage.py migrate
Load sample data fixtures (for now):
$ python manage.py loaddata MatterType.json
If you want an extensive and realistic dataset, you can import a dump from our production scraper. Here are some steps.
curl -O http://archive.knilab.com.s3.amazonaws.com/cityhallmonitor/chm_prd_20160112_data.gz
./clear_chm_tables.sh
gzcat chm_prd_20160112_data.gz | python manage.py dbshell