Python demo app for 'Cloud Craft for Spatial Cadets' presentation
Python Shell CSS
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.openshift
static
.gitignore
DATA-LICENCE
README.md
app.py
conveniences.cfg
conveniences.py
setup.py
wellington-city-public-conveniences.json

README.md

Map of Public Conveniences in Wellington

powered by Flask, Python, MongoDB, and Leaflet.js

To deploy a clone of this application using the rhc command line tool:

rhc app create conveniences python-2.7 mongodb-2.4 --from-code=https://github.com/codemiller/cloud-craft-python.git -s

To use Python 3.3 or 2.6, replace the Python cartridge version in the command.

Alternatively, link to a web-based clone+deploy on OpenShift Online or on your own OpenShift cloud:

https://openshift.redhat.com/app/console/application_type/custom?cartridges%5B%5D=python&scale=true&cartridges%5B%5D=mongodb-2&initial_git_url=https%3A%2F%2Fgithub.com%2Fcodemiller%2Fcloud-craft-python.git

A demo is available at: http://conveniences-cloudcraft.rhcloud.com/

Local Development

To run the application locally, install Python, MongoDB 2.4 or higher, and the required Python modules in setup.py (these can be installed using Pip, eg: sudo pip install Flask && sudo pip install pymongo).

If you do not want to install MongoDB locally, you could instead use rhc port-forward and set the database connection parameters in conveniences.cfg to point to your instance of MongoDB hosted on OpenShift (or elsewhere).

Make sure MongoDB is running, and add the data and index with commands such as the following:

mongoimport -d conveniences -c toilets --type json --file wellington-city-public-conveniences.json
mongo conveniences --eval 'db.toilets.ensureIndex( { "geometry.coordinates" : "2dsphere" } )'

Check that the default DB connection parameters in conveniences.cfg match your MongoDB instance.

Run the app on localhost with the following command:

python app.py

License and Credits

This code is dedicated to the public domain to the maximum extent permitted by applicable law, pursuant to CC0 (http://creativecommons.org/publicdomain/zero/1.0/)

App based on code by TheSteve0 and ryanj.

Toilet icons and banner contributed by Ben Hoad.