Skip to content

Commit

Permalink
Merge branch 'master' of github.com:caciviclab/disclosure-backend int…
Browse files Browse the repository at this point in the history
…o noReport

* 'master' of github.com:caciviclab/disclosure-backend:
  Set the ShowSuperceded parameter
  Join errors with a newline and coerce them to strings
  Don't re-raise errors in xformnetfilerawdata
  Add custom error for missing locality
  Add short_name for Alameda city/county
  ignore the entire data/ dir
  Add missing forms
  Move FIXTURES_DIR into disclosure app
  added csv files for candidates and ballot measures to data/fixtures
  BF: caciviclab#236: Restore django-rest-swagger to earlier version
  take out colon
  fix spacing
  fix formatting for steps 5 and 6 in software installation
  edited the read me
  Find ballot based on locality_id

Conflicts:
	finance/management/commands/xformnetfilerawdata.py
  • Loading branch information
mikeubell committed Aug 14, 2016
2 parents 65d202b + bc82ddd commit 8edb801
Show file tree
Hide file tree
Showing 19 changed files with 28,265 additions and 42 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
*.pyc

# Data
data/calaccess
data/netfile
/data/

# Django
settings_local.py
Expand Down
74 changes: 44 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,17 @@ We're going to create an environment with Python 2.7.9 for the project
### Software Installation

0. Clone `disclosure-backend` (or your fork of it) to your own local copy.
1. Install `python` and `pip` (if using Anaconda, pip is already installed)
2. Create an environment for this project:

1. Install `python` or `anaconda` or `conda` (If using OSX (Mac) python is already installed, if using Linux, install anaconda, if using Windows, you can choose between conda and python but we recommend python)
* [Anaconda Distribution] (https://docs.continuum.io/anaconda/install)
* [Python Distribution - Windows] (http://www.howtogeek.com/197947/how-to-install-python-on-windows/) - install version 2.7.9

2. Install `pip` (if using Anaconda, pip is already installed.)
```
sudo easy_install pip
```
3. Create an environment for this project:
* For non-Anaconda Python distribution
```
sudo pip install virtualenv
Expand All @@ -43,46 +52,60 @@ We're going to create an environment with Python 2.7.9 for the project
source activate ODB
```
(you will have to activate this environment (or virtualenv) every time you want to start working)
You will have to activate this environment (or virtualenv) every time you want to start working. You activate using:
```
source env/bin/activate
```
Or
```
source activate ODB
```
3. Install mysql and other system dependencies
4. Install mysql and other system dependencies
OSX:
```
brew install mysql
brew install libssl
brew install graphviz
brew install pkg-config
pkg-config --cflags-only-I libcgraph

brew install mysql
brew install libssl
brew install graphviz
```
* If ```brew install libssl``` does not work don't worry about it.
* When prompted for a password, remember it because you'll need it.
4. Install project requirements with:
5. Install project requirements with:
```
pip install -r requirements.txt
pip install -r requirements_dev.txt
```
* Did you encounter an error that says something like ` fatal error: 'graphviz/cgraph.h' file not found` ?
Run
```
cd /usr/local/Cellar/graphviz/2.38.0/include/graphviz/
mkdir graphviz
cp cgraph.h graphviz/
```
Then try
```
pip install -r requirements_dev.txt
```
### Database setup
1. Create the database
```
mysql -p --user root
mysql -u root
mysql> create database opendisclosure;
mysql> create database calaccess_raw;
mysql> \q
```
2. Create `disclosure/settings_local.py`
```
DATABASES['default']['PASSWORD'] = '' # replace with your password.
DATABASES['calaccess_raw']['PASSWORD'] = '' # replace with your password.
```
Change the password field to the password you chose when you installed MySQL.
3. Run the server setup script
2. Run the server setup script
```
python manage.py setuptestserver
```
Expand Down Expand Up @@ -140,15 +163,6 @@ python manage.py downloadnetfilerawdata
python manage.py xformnetfilerawdata
```
#### Cal-Access
Cal-Access is the state data. It's ~750MB of data and takes over an hour to
trim, clean and process.
```
python manage.py downloadcalaccessrawdata
```
### Run the server
Expand Down
6 changes: 3 additions & 3 deletions ballot/views/ballot.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class BallotViewSet(viewsets.ViewSet):
response_serializer: BallotSerializer
"""
@detail_route(['GET'])
def retrieve(self, request, ballot_id, locality_id=None):
def retrieve(self, request, ballot_id):
"""
Ballot data, including a list of ballot items.
"""
Expand All @@ -37,5 +37,5 @@ def current_ballot(self, request, locality_id):
"""
The most recent active ballot.
"""
return super(CurrentBallotViewSet, self).retrieve(
request=request, ballot_id=1, locality_id=locality_id)
ballot = get_object_or_404(Ballot, locality_id=locality_id)
return Response(BallotSerializer(ballot).data)
1 change: 0 additions & 1 deletion data/fixtures/2016_05_02_locality.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 8edb801

Please sign in to comment.