Skip to content
Stephen Brennan edited this page Feb 18, 2017 · 2 revisions

The README has decent instructions for getting the app set up on a new account in production. But these are more specific for getting your local dev environment set up.

These instructions are targeted at Linux (especially Arch Linux) - it's really the easiest to use for this sort of development. On Mac and PC everything is still possible, but you're on your own.

Install Google App Engine

You need Google App Engine installed in order to use this. You have two options:

Install GAE Globally

You can install GAE globally. Download here. There is an Arch AUR package here which is ok, I guess.

The most important thing is that the two scripts dev_appserver.py and appcfg.py are in your PATH. The Arch package puts dev_appserver.py in your path (by symlinking it into /usr/bin), but doesn't do that for appcfg.py. So you can easily address this by doing:

$ sudo ln -s /opt/google-cloud-sdk/platform/google_appengine/appcfg.py /usr/bin/appcfg.py

Use Local GAE

The makefile downloads a GAE package that you can (?) use as well, I guess. In that case, you need to add /path/to/love/google_appengine to your PATH whenever you're working on it. Kinda a hassle but if that works better for you, do it.

Install Tox

You need to install Tox for the Makefile to work. There is probably a distribution package for this if you're on Linux. On Arch, the package is python-tox. You can use tox installed on Python 3 or 2 -- it does not matter, since tox merely manages the Python 2 virtualenvs that the application eventually runs in.

Configure

Simply copy config-example.py to config.py. Our specific settings are:

APP_NAME = 'CWRU Love'
APP_BASE_URL = 'http://cwrulove.appspot.com/'
LOVE_SENDER_EMAIL = 'CWRU Love <love@cwrulove.appspotmail.com>'
DOMAIN = 'case.edu'
GRAVATAR = 'always'
ORG_TITLE = 'University'

You can generate your own SECRET_KEY with:

import os
os.urandom(24)

You're going to need to add at least one Employee to your database. For this, copy import/employees.csv.example to import/employees.csv and edit it to include yourself - use a CWRU email. Department options are listed in departments.yaml. You can leave the photo_url blank -- it isn't used anyway.

First Run

$ make run-dev

The app is accessible at http://localhost:8080. Log in with the email address you put in the employees.csv file, and check the box to log in as admin. You'll get an internal error at first. Go straight to http://localhost:8080/employees/import and click the button to Import. Now you shouldn't get any more errors, and you won't have to do this in subsequent runs.

You can "log in" as any (@case.edu) email address you'd like, but this will only work if the email address has been imported from the CSV file already. You can go back to the login page at any time by visiting http://localhost:8080/_ah/login. This allows you to log back out and change accounts.

Run Tests

Please run tests before pushing any changes!

$ make test

The tests include enforcing code style, so just because your changes don't involve/need tests doesn't mean that you don't need to run them. It's nice to avoid follow-up commits with fixes where we can.

GIT

You need to read Git before you start committing and pushing changes!

Clone this wiki locally