/fec-cms

The content management system (CMS) for the new Federal Election Commission website.

Primary LanguageHTMLOtherNOASSERTION

Campaign finance for everyone

The Federal Election Commission (FEC) releases information to the public about money that’s raised and spent in federal elections — that’s elections for US president, Senate, and House of Representatives.

Are you interested in seeing how much money a candidate raised? Or spent? How much debt they took on? Who contributed to their campaign? The FEC is the authoritative source for that information.

betaFEC is a collaboration between 18F and the FEC. It aims to make campaign finance information more accessible (and understandable) to all users.

FEC repositories

We welcome you to explore, make suggestions, and contribute to our code.

This repository, fec-cms, houses the content management system (CMS) for betaFEC.

  • FEC: a general discussion forum. We compile feedback from betaFEC’s feedback widget here, and this is the best place to submit general feedback.
  • openFEC: betaFEC’s API
  • openFEC-web-app: the betaFEC web app for exploring campaign finance data
  • fec-style: shared styles and user interface components
  • fec-cms: the content management system (CMS) for betaFEC. This project uses Wagtail, an open source CMS written in Python and built on the Django framework.

Get involved

We’re thrilled you want to get involved!

  • Read our contributing guidelines. Then, file an issue or submit a pull request.
  • Send us an email at betafeedback@fec.gov.
  • If you’re a developer, follow the installation instructions in the README.md page of each repository to run the apps on your computer.
  • Check out our StoriesonBoard FEC story map to get a sense of the user needs we'll be addressing in the future.

Set up

Installation

Install PostgreSQL.

On Mac OS:

brew install postgres

On Ubuntu:

apt-get install postgres

Install dependencies:

npm install
npm install -g gulp
pip install -U -r requirements.txt

Set up:

npm run build
./manage.py makemigrations
./manage.py migrate
./manage.py createsuperuser

Watch for changes

To watch for changes to .js and .scss:

npm run watch

Developing with fec-style (optional)

If you're developing with a local instance of FEC-Style and want to pull in styles and script changes as you go, use npm link to create a symbolic link to your local fec-style repo:

cd ~/fec-style
npm link
cd ~/openFEC-web-app
npm link fec-style

After linking fec-style, npm run watch will rebuild on changes to your local copy of fec-style's .scss and .js files.

Developing with openFEC (optional)

Environment variable:

export FEC_APP_URL=http://localhost:3000

Settings:

FEC_APP_URL = 'http://localhost:3000'

Features

settings.py includes a set of FEATURES which can be enabled using environment flags or via settings.local:

FEC_FEATURE_LEGAL=1 python fec/manage.py runserver

Run

./manage.py runserver

Deploy

Likely only useful for 18F team members

Before deploying, install the Cloud Foundry CLI and the autopilot plugin:

cf install-plugin autopilot -r CF-Community

Provision development database:

cf create-service rds micro-psql fec-rds-stage

Provision credentials service:

cf cups cms-creds-dev -p '{"DJANGO_SECRET_KEY": "..."}'

To deploy to Cloud Foundry, run invoke deploy. The deploy task will attempt to detect the appropriate Cloud Foundry space based the current branch; to override, pass the optional --space flag:

invoke deploy --space feature

The deploy task will use the FEC_CF_USERNAME and FEC_CF_PASSWORD environment variables to log in. If these variables are not provided, you will be prompted for your Cloud Foundry credentials.

Deploys of a single app can be performed manually by targeting the env/space, and specifying the corresponding manifest, as well as the app you want, like so:

cf target -s [feature|dev|stage|prod] && cf push -f manifest_<[feature|dev|stage|prod]>.yml [api|web]

NOTE: Performing a deploy in this manner will result in a brief period of downtime.

Backup

To restore data from a remote instance to a local instance, or between local instances, back up data using dumpdata and restore using loaddata. You'll also need to install cf-ssh. The following is an example of restoring remote data to a local instance.

Use cf target -s to select the space you want to create a manifest for, then:

# Local
cf create-app-manifest cms -p manifest_ssh.yml
cf-ssh -f manifest_ssh.yml

# Remote
cd fec
./manage.py dumpdata --settings fec.settings.production --exclude sessions.session --exclude contenttypes.ContentType --exclude auth.permission --exclude auth.user --output dump.json

# Local
cd fec
cf files cms-ssh app/fec/dump.json | tail -n +4 > dump.json
./manage.py loaddata dump.json

Copyright and licensing

This project is in the public domain within the United States, and we waive worldwide copyright and related rights through CC0 universal public domain dedication. Read more on our license page.

A few restrictions limit the way you can use FEC data. For example, you can’t use contributor lists for commercial purposes or to solicit donations. Learn more on FEC.gov.