SCPR / kpcc_backroom_handshakes

Django project and applications to ingest and display election results and force aspects of the political process to give each other a clean handshake ... with gloves on.
MIT License
0 stars 1 forks source link

What is this?

A project of loosely coupled applications that force aspects of the political process to give each other a clean handshake ... with gloves on.

But seriously...

Table of Contents

Assumptions

If any of these are not true, please skip ahead to Building a Mac OS Python dev environment

Quickstart To Get Up And Running


Ingesting And Baking Election Data

Assuming you're up and running successfully, let's attempt to see if we can access data from the most recent election...


Config and Settings

Still very much learning how to configure a collaborative project in different environments, I feel this is a good start to a path that allows for experimentation among collaborators without having to keep too many settings files in sync. Of course, like with all things, we'll learn something new that makes all of this seem silly.

The Files

The Variables

We started to add some variables to development.yml. Here's what all of the variables in that file stand for.


Available Fabric Commands

Functions That Fetch Our Election Data From Our Sources

Dump And Load Existing Election Data

django-bakery functions

Development Functions

Bootstrapping Functions


Building A Mac OS Python Dev Environment


Docker Setup

Or, you can use Docker.

Prerequisites

Instructions

A Dockerfile is included, which will build the entire environment into a Docker image. This includes Python and dependencies needed for building requirements from source.

To build the image, run docker-compose up -d backroom-handshakes.

The build step can take several minutes, but you should only have to do it once.

If you don't have an instance of MySQL or MariaDB running already, docker-compose.yml includes a minimal MySQL setup. Just run docker-compose up -d mysql, and you should now have a development instance ready to use.

Open up your a shell for your container:

docker-compose exec backroom-handshakes /bin/sh

Now, within that shell, you can continue to install your required modules:

pip install -r requirements.txt

At this point, you can continue with the "quickstart" instructions listed above. The only difference is, if you decided to run the MySQL container, you should change the database host in development.yml to this:

  database:
    host: mysql
    port: 3306
    database: kpcc_backroom_handshakes
    username: root
    password: password

Notes

Remmber that build.build_dir in development.yml must be an absolute path, not relative. For development, simply setting this configuration to /home/latest_build works fine.