This is the API for the Work the Elections project. The project is sponsored by the Knight Foundation is developed by the Development Seed and FEC (previously FELN).
- Python 3.6.3
- Postgres 9.6 with PostGIS support
- docker
Build the docker image:
$ docker-compose build base
Download the data first:
$ git clone https://github.com/developmentseed/data.work.vote.git exports
$ docker-compose run --rm migrate
$ docker-compose run --rm createsuperuser
$ docker-compose run --rm import
$ docker-compose run --rm --service-ports serve
Replace the geojson file at apps/jurisdiction/voteworker.geojson
, then run:
$ docker-compose run --rm boundaries
To generate jurisdiction png files run:
$ docker-compose run --rm rasterize
PNG files are stored at config/static/jurisdictions
To access django shell run
$ docker-compose run --rm shell
WARNING: this is NOT recommended and could damage the production website.
To serve the website with the Heroku environment locally, first download all the environment variables:
$ heroku config -s -a workelections > config.txt
Then run:
$ docker-compose run --rm --service-ports prod
$ docker-compose run --rm export
Run all tests:
$ docker-compose run --rm base_django_setup python3 manage.py test apps
Run tests, reusing test DB. This is significantly faster, but requires that tests clean up after themselves. Django TestCases mostly take care of this.
$ docker-compose run --rm base_django_setup python3 manage.py test apps --keepdb
master
branch is deployed to Heroku. To deploy, PR to master
. Direct push to master is disabled.
We use Heroku Containers for deploying this application to Heroku.
To get started, make sure you are logged in by running heroku container:login
.
$ heroku container:push web
$ heroku container:release web
$ heroku run python manage.py migrate