How to contribute

This walkthrough will show you how to install the source code of this application to fix bugs and develop new features.

First create a new virtualenv.

$ virtualenv django-calaccess-campaign-browser

Jump in.

$ cd django-calaccess-campaign-browser
$ . bin/activate

Clone the repository from GitHub.

$ git clone https://github.com/california-civic-data-coalition/django-calaccess-campaign-browser.git repo

Installing the database

Move into the repository and install the Python dependencies.

$ cd repo
$ pip install -r requirements_dev.txt

Make sure you have MySQL installed. If you don’t, now is the time to hit Google and figure out how. If you’re using Apple’s OSX operating system, you can install via Homebrew. If you need to clean up after a previous MySQL installation, this might help.

Then create a new database named calaccess.

$ mysqladmin -h localhost -u root -p create calaccess

If you have a different username, substitute it above. You’ll be prompted for that user’s mysql password.

Create a file at example/project/settings_local.py to save your custom database credentials. That might look something like this.

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'calaccess',
        'USER': 'your-username-here',
        'PASSWORD': 'your-password-here',
        'HOST': 'localhost',
        'PORT': '3306',
        'OPTIONS': {
            'local_infile': 1,
        }
    }
}

Finally create your database and get to work.

$ python example/manage.py migrate

Loading the data

You might start by loading the data dump from the web.

$ python example/manage.py downloadcalaccessrawdata

Then you can build the campaign finance models

$ python example/manage.py buildcalaccesscampaignbrowser

And fire up the Django test server to use the browser

$ python example/manage.py collectstatic
$ python example/manage.py runserver