This is a demo app for mobiles written using Flask and jQuery Mobile. The backend storage is MongoDB.
The app allows you to check and edit some shopping lists from your mobile phone! So if your fellow file it from home, you’ll have it at your fingers later, when at the mall!
It has been deployed on OpenShift which offers MongoDB instances for free, as well as support for any Python WSGI app. Flask is installed using virtualenv.
Create the application on OpenShift:
$ rhc app create -a myshoppinglist -t python-2.6
add the mongodb cartridge:
$ rhc app cartridge add -a myshoppinglist -c mongodb-2.0
add the remote github repo to the existing one with a command like:
$ cd myshoppinglist $ git remote add upstream git://github.com/openshift/openshift-myshoppinglist.git
and then pull in your local repo the changes:
$ git pull -X theirs upstream master $ git push
that’s it! the database connectivity is guaranteed by the following environment variables, defined on the OpenShift servers:
dbhost = os.environ['OPENSHIFT_NOSQL_DB_HOST'] dbport = int(os.environ['OPENSHIFT_NOSQL_DB_PORT']) dbuser = os.environ['OPENSHIFT_NOSQL_DB_USERNAME'] dbpass = os.environ['OPENSHIFT_NOSQL_DB_PASSWORD']
if you choose to give the app a different name, don’t forget to reflect the changes in the ‘application’ file where, by default, the database opened is called ‘myshoppinglist’.
Enjoy!