See also http://github.com/18F/openFEC.
This application is in Flask. Client side features are managed using Browserify and npm.
It uses Python version 3.4. Its recommended that you create a virtualenv before installing Python dependencies.
Install Python dependencies:
$ pip install -r requirements.txt
Install client side dependencies:
$ npm install -g browserify
$ npm install
If you plan to do CSS development, you will want to install Sass.
If you plan to do client side JS developent, you will want to install Watchify:
$ npm install -g watchify
The Flask app talks to an API for data. See openFEC.
The app has HTTP auth enabled. You will need to set environment variables with your desired username and password.
Those vars are FEC_WEB_USERNAME
and FEC_WEB_PASSWORD
. There are other config environment variables that you
can set, but that have defaults. You can see those in openfecwebapp/config.py
.
To make the site fully functional, you will need to compile the client side JS:
$ npm run build
Then start the server:
$ python __init__.py
If you'd like the app to cache API requests it makes, use the --cached
flag:
$ python __init__.py --cached
To compile client side JS changes once:
$ npm run build
To compile whenever changes are made to the client side JS:
$ npm run watch
Compile Sass once:
$ npm run sass-build
Compile Sass as changes are made:
$ npm run sass-watch
Or, if you want to get crazy, watch both Sass and JS changes: (hat tip @ascott1)
$ npm run watch-all
If you want to deploy to one of our Cloud Foundry instances, use deploy.sh
. It takes four arguments: the Cloud Foundry space, the Cloud Foundry app, HTTP username, HTTP password. Be sure to be in the root directory of the codebase you want to deploy.
./deploy.sh cf-space cf-app http-user http-pass
Ask teammates for the username and password that should be used.
$ nosetests openfecwebapp/tests
First, install PhantomJS.
Then:
$ nosetests openfecwebapp/tests -a 'selenium'