Skip to content

davidsoloman/openFEC-web-app

 
 

Repository files navigation

openfec-web-app

Build Status

See also http://github.com/18F/openFEC.

Installing

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

Configuration

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.

Run server

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

Development

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

Deployment

Likely only useful for 18Fers

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.

Run Tests

Unit Tests

$ nosetests openfecwebapp/tests

Browser Tests

First, install PhantomJS.

Then:

$ nosetests openfecwebapp/tests -a 'selenium'

About

Server- and client-side web application for the OpenFEC data site.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 61.0%
  • HTML 22.0%
  • Python 9.3%
  • JavaScript 7.4%
  • Shell 0.3%