Code Monkey home page Code Monkey logo

nearby's Introduction

Local

Local is Code for SA's set of Django applications for helping users find data local to them.

Included apps:

Data Sources

This app loads data from the IEC's API (elections.org.za) and supplements it with data from the Google Sheet at https://docs.google.com/spreadsheets/d/1rtez8t8MGtG7vTQe-wyCrIgsgejwddoshrPkYPECC7E/edit#gid=0

The data from the IEC is cached in a local database cache and is used only if the IEC server is down.

Local development

  1. clone the repo
  2. cd nearby
  3. virtualenv --no-site-packages env
  4. pip install -r requirements.txt

You will need to set some environment variables, which are in the Nearby projects folder on Google Drive. The GOOGLE_SHEETS_API_KEY is big, the simplest way to handle it is to download it into a local file.

export IEC_API_USERNAME=the-username
export IEC_API_PASSWORD=the-password
export GOOGLE_SHEETS_EMAIL=the-email
export GOOGLE_SHEETS_PRIVATE_KEY=`cat google-sheets-key.txt`

Then setup the database and run the server:

python manage.py createcachetable
python manage.py runserver

Production deployment

Production deployment assumes you're running on Heroku.

You will need:

heroku create
heroku addons:add heroku-postgresql
heroku config:set DJANGO_DEBUG=false \
                  DISABLE_COLLECTSTATIC=1 \
                  DJANGO_SECRET_KEY=some-secret-key \
                  NEW_RELIC_APP_NAME=cool app name \
                  NEW_RELIC_LICENSE_KEY=new relic license key \
                  IEC_API_USERNAME=the-username \
                  IEC_API_PASSWORD=the-password \
                  GOOGLE_SHEETS_EMAIL=google sheets user email \
                  GOOGLE_SHEETS_PRIVATE_KEY=contents-of-private-key
git push heroku master

License

MIT License

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.