Stump is a non-partisan, crowd-sourced, voter-empowerment platform. Sign up to try the prototype.
- Python 3.6 or higher
- pipenv
- PostgreSQL 10 and SQLite3 OR
- Docker (optional)
- GNU make >= 3.81 (optional)
On localhost:
$ cd backend/api
$ pipenv sync --dev
$ pipenv shell
$ cd stump_backend
$ python manage.py migrate
$ python manage.py createsuperuser
$ python manage.py runserver
With docker-compose:
- Copy and paste the following environment variables into
backend/api/.env.dev
:
DEBUG=1
SECRET_KEY=stump_dev
DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]
DB_USER=stump_dev
DB_PASSWORD=stump_dev
DB_NAME=stump_dev
DB_HOST=postgres
DB_PORT=5432
DATABASE=postgres
- In terminal, navigate to project root, then do
$ cd backend
$ docker-compose -f docker-compose.local.yml up --build -d
$ docker-compose -f docker-compose.local.yml exec api python manage.py migrate
$ docker-compose -f docker-compose.local.yml exec api python manage.py createsuperuser
or with make
:
$ cd backend
$ make stump_backend.up
$ make stump_backend.createsuperuser
- http://localhost:8000/admin/
- http://localhost:8000/api/v0/samples/
- http://localhost:8000/api/v0/somedata/
- http://localhost:8000/api/v0/candidates/
$ python manage.py test --settings stump_backend.test_settings
To generate a coverage report of an app, and place the results in HTML files in the cover
directory:
$ APP=api python manage.py test --settings stump_backend.test_settings
The following environment variables should be set using the command line or using .env files:
- Django app (
backend/api/.env.prod
):- DEBUG : set to 1 to run django server in debug mode and 0 otherwise (see Django docs for DEBUG)
- SECRET_KEY : secret key for Django app (see SECRET_KEY)
- DJANGO_ALLOWED_HOSTS : hosts that Django is allowed to serve (see ALLOWED_HOSTS)
- DB_USER (see Django docs for DATABASES)
- DB_PASSWORD (see Django docs for DATABASES)
- DB_NAME (see Django docs for DATABASES)
- DB_HOST (see Django docs for DATABASES)
- DB_PORT (see Django docs for DATABASES)
- Postgres (
backend/api/.env.prod.db
):- POSTGRES_USER : name of database user
- POSTGRES_PASSWORD : user's password
- POSTGRES_DB : name of the application database
$ cd backend
$ docker-compose -f docker-compose.prod.yml up -d --build
$ docker-compose -f docker-compose.prod.yml exec api python manage.py migrate --noinput
$ docker-compose -f docker-compose.prod.yml exec api python manage.py collectstatic --no-input --clear
Name | Role | Contact |
---|---|---|
Brian Hedden | ||
Carlos Perez | Backend Engineer | [email protected] |
Henry Lai | ||
Wes Galbraith | Backend Engineer | [email protected] |
Zachary Rose |