Skip to content

Setting Up Development Environment

Waseem Ahmad edited this page Aug 28, 2014 · 1 revision

This page shows you how to set up your local and cloud development environment.

Local Development

Environment

In order to set up a local development environment, you need the following:

After pulling the source code for the application, create a file under the authentication folder called secretparams.py with the following content:

COOKIE_KEY = "<secretstring>"

Replace with the string located in Rice Apps resources for Rice Elections. If you do not intend to deploy the application to the cloud, simply generate a random string in Python

import os
os.urandom(64).encode('hex')

Running the application

In order to run the application, simply use the Google App Engine Python Development Server. If you have the App Engine launcher (Windows & Mac), you can simply run your application from there.

Populating with data

Modify the setup.py script in the source code to create an organization and make yourself an admin of it. You can run the setup script through the remote_api shell.

> cd src
> remote_api_shell.py -s localhost:8080
> Email: abc@gmail.com
> Password: abc123
dev~olwection> from scripts import setup
dev~owlection> setup.main()
Creating organizations...
Done.
Creating admins...
Done.  

Remote Api Shell

The remote api shell in Google App Engine lets you access the cloud environment through an interactive console for both your development version and the deployed cloud version of your application. In order to use the remote_api simply invoke the following command from the src folder of your application.

Local:

remote_api_shell.py -s <hostname>

Make sure to replace with your local server address. E.g. localhost:8080
Any well formed email and password combination will allow you to access the api shell. E.g.
Email: abc@gmail.com
Password: abc123

Cloud:

remote_api_shell.py -s owlection.appspot.com

Note, you must have a developer account registered on the cloud application to access the api shell.
Warning: Any code you execute in the api_shell will reflect live on the deployed application. Changes made to the database will be real. BE CAREFUL!

Deploying to Cloud

In order to deploy the application to the cloud, you must be a registered developer for owlection.

  1. Thoroughly test your changes after developing.
  2. Under app.yaml, change the application version.
  3. Use appcfg.py or App Engine launcher to upload the application.
  4. Go to the administration dashboard under appengine.google.com and change the active version of the application to your new version.
  5. If you need to quickly revert your changes, simply make the older version active again. Note: You can also split traffic between various versions of the application.