The Django source code for the GovTrack.us website.
Python HTML JavaScript CSS Shell
Clone or download
Permalink
Failed to load latest commit information.
analysis tweak vote export script May 16, 2018
bill stakeholders: if an admin, show stakeholder name in bill page teaser May 7, 2018
build merge cloud deployment / accessibility fixes branch Aug 7, 2017
committee person committee role db optimizations Jan 26, 2018
conf add rate limiting and extend cache durations to lighten server load May 17, 2018
events expand email updates announcements to all users with email updates tu… Mar 23, 2018
ext reCAPTCHA 2 needed now for reset password page Apr 14, 2018
files add 2017 backer update PDF Jul 13, 2017
lib switch django-haystack to pip module rather than submodule Aug 2, 2017
parser add Bill.original_intent_replaced field where we can manually mark bi… Jan 6, 2018
person the main map page broke because it wasn't passing mapbox API key vari… Jun 17, 2018
redirect update urlpatterns for Django 1.10 compatibility Aug 2, 2017
smartsearch misc Feb 11, 2018
stakeholder add stakeholder verified status to post admin page May 17, 2018
static forgot staff photos Jun 7, 2018
templates upgrade Mapbox GL scripts to fix scrolling bug reported by a user Jun 17, 2018
twostream hiding the ads wasn't working because the 'user' template context var… Nov 4, 2017
userpanels misc fixes Nov 30, 2017
vote add a vote comparison for the tax cut, omnibus, and balanced budget a… Apr 13, 2018
website new tip Jun 7, 2018
.env.deploy.template Add template files for the environment settings Jun 5, 2017
.gitignore move settings.env to the 'local' subdirectory to keep local data sepa… Aug 2, 2017
.gitmodules bump django-registration-pv Oct 14, 2017
DEPLOY.md Add a fabric command for data folder backups Jun 5, 2017
Procfile Add a Procfile for honcho to export Jun 5, 2017
README.md activate the environment and load settings automatically as a part of… Aug 12, 2017
Vagrantfile wget'ing the fixtures with -N (download if newer) is better than -nc … Oct 29, 2017
__init__.py lots of cool more work on the site Feb 26, 2012
civic.json add civic.json May 28, 2015
color-palette.html new more colorful and friendly bill and person page layouts Oct 2, 2016
fabfile.py rename build/pipreq.txt to just requirements.txt Aug 2, 2017
manage.py Use an intermediate script to run a python interpreter for manage.py. Jun 5, 2017
minify Run python executables directly, instead of in the venv dir Jun 5, 2017
parse.py Updated percent_yes implementation based on pull_request feedback Jul 27, 2015
python_rand_hash simplify environment settings a bit Aug 24, 2017
requirements.txt add charts to the misconduct page based on https://github.com/dimka-a… Jun 4, 2018
run_scrapers.py Cato DeepBills was discontinued long ago, scraper is being removed fr… Dec 9, 2017
script simplify environment settings a bit Aug 24, 2017
settings.env.template move mapbox map keys into settings Jun 16, 2018
settings.py we aren't using django-wysiwyg anymore either Mar 9, 2018
settings_env.py move mapbox map keys into settings Jun 16, 2018
u adding my 'u' unsubscribe script Dec 18, 2016
urls.py add new 'stakeholder' app and a link on bill pages to get orgs to sig… Feb 11, 2018
us.py add AP-style state abbreviations, for fun Mar 25, 2017
wsgi.py outbound email switched to elasticmail Sep 24, 2017

README.md

GovTrack website frontend

This repo contains the source code of the front-end for www.GovTrack.us. The data-gathering scripts are elsewhere.

Local Development

Development using Vagrant

GovTrack.us runs on Ubuntu 16.04 or OS X. To simplify local development, we have a Vagrantfile in this directory. You can get started quickly simply by installing Vagrant and running:

# Get this repo (you must clone with `--recursive`)
git clone --recursive https://github.com/govtrack/govtrack.us-web.git

# Change to this repo's directory.
cd govtrack.us-web

# Start Vagrant.
vagrant up

# Create your initial user.
vagrant ssh -- -t ./manage.py createsuperuser

# Start debug server.
vagrant ssh -- -t ./manage.py runserver 0.0.0.0:8000

# Visit the website in your browser at http://localhost:8000!

# Stop the virtual machine when you are done.
vagrant suspend

# Destroy the virtual machine when you no longer are working on GovTrack ever again (or when you want your disk space back).
vagrant destroy

Even though the site is running in the virtual machine, it is using the source files on your host computer. So you can open up the files that you got from this repository in your favorite text editor like normal and the virtual machine will see your changes. When you edit .py files, runserver will automatically restart to re-load the code. The site's database and search indexes are also stored on the host machine so they will be saved even when you destroy your vagrant box.

See further down about configuration.

Development without Vagrant

To set up GovTrack development without a virtual machine, get the source code in this repository (use --recursive, as mentioned above), and then you'll need to follow along with the steps in our Vagrantfile by just looking at what we did and doing the same on your command line.

At the end:

# Create your initial user.
./manage.py createsuperuser

# Start the debug server.
./manage.py runserver

Configuration

Some features of the site require additional configuration. To set configuration variables, create a file named local/settings.env and set any of the following optional variables (defaults are shown where applicable):

# Database server.
# See https://github.com/kennethreitz/dj-database-url
DATABASE_URL=sqlite:///local/database.sqlite...

# Memcached server.
# See https://github.com/ghickman/django-cache-url#supported-caches
CACHE_URL=locmem://opendataiscool

# Search server.
# See https://github.com/simpleenergy/dj-haystack-url#url-schema
#
# For local development you may want to use the (default) Xapian search engine, e.g.:
# xapian:/home/username/govtrack.us-web/xapian_index_person
#
# For a production deployment you may want to use Solr instead, e.g.:
# solr:http://localhost:8983/solr/person
#
# You can also specify 'simple' to have a dummy search backend that
# does not actually index or search anything.
HAYSTACK_PERSON_CONNECTION=xapian:local/xapian_index_person
HAYSTACK_BILL_CONNECTION=xapian:local/bill

# Django uses a secret key to provide cryptographic signing. It should be random
# and kept secure. You can generate a key with `./manage.py generate_secret_key`
SECRET_KEY=(randomly generated on each run if not specified)

See settings.env.template for details, especially for values used in production.

Credits

Emoji icons by http://emojione.com/developers/.