Giter VIP home page Giter VIP logo

stump_vote's Introduction

Stump

Stump is a non-partisan, crowd-sourced, voter-empowerment platform. Sign up to try the prototype.

Frontend Development

Backend Development

Django development notes

Dependencies

  • Python 3.6 or higher
  • pipenv
  • PostgreSQL 10 and SQLite3 OR
  • Docker (optional)
  • GNU make >= 3.81 (optional)

Quickstart

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:

  1. 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
  1. 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

Sample and testing API endpoints

Unit testing

$ 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

Deployment

Environment Variables

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

Running in production mode

$ 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

Maintainers

Name Role Contact
Brian Hedden
Carlos Perez Backend Engineer [email protected]
Henry Lai
Wes Galbraith Backend Engineer [email protected]
Zachary Rose

stump_vote's People

Contributors

coloradocarlos avatar galbwe avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.