The code here will power VPR's Town Meeting Day Results table.
##Notes on the Project
The project was built off of VPR's App Template. The steps to get set up are here:
- Make sure you have Python 2.7 installed.
- Clone the repo locally.
git clone git@github.com:vprnet/town-meeting-day-2017.git
- Install
pip
- Install virtualenv.
pip install virtualenv
- Change into the project directory.
cd town-meeting-day-2017
- Create a virtual environment for the app.
virtualenv venv
- Enter the virtual environment.
source venv/bin/activate
- Install the app requirements.
pip install -r requirements.txt
- To run locally, hit a quick
python runserver.py
and head to127.0.0.1:5000
, but know that it will be broken until you follow the Google Spreadsheet steps below.
##Notes on Interacting with Google Spreadsheets
The project is hooked up to a Google Spreadsheet that VPR reporters can populate. If you're interested in cloning this project, you'll need your own Google Spreadsheet to get started.
We use gspread with the Drive API to connect our spreadsheet to the app. Here are a few things to know about the implementation:
- To start a new project, head to the Google Developer's Console.
- Click
create a project
. Give it a name. - Click
Enable and manage APIs
. - Under
Google Apps APIs
clickDrive API
andEnable
. - Click
Go to Credentials
. Create Credentials
.Create service account key
, and selectNew service account
. Give it a name.- When you
create
, you'll see a JSON file incoming. Save that file to your project directory. Add it to your gitignore if your code is going anywhere public. - The json file is what gets loaded and opened in
sheet.py
. Make sure the names match. - Create a Google Spreadsheet through your Google Drive. Make sure your spreadsheet title is exactly what's trying to be opened in
sheet.py
'sauthorization.open("")
line. To match our project, you'll need a worksheet with columns:Town
,Town_Budget
,School_Budget
, andSource
. - You may need to share your Google Spreadsheet with the email provided in
client_email
.