Python is same as WSGI in OpenShift

01 Apr 2012
Posted by stylesen

In most of the old blog posts on OpenShift, in order to create Python based applications we could see the catridge that needs to be used is wsgi-3.2.1. This was confusing since, the help message of new 'rhc' clients does not lista cartridge of type 'wsgi' as follows:

  -t|--type         type         Type of app to create (nodejs-0.6, jbossas-7, python-2.6, jenkins-1.4, ruby-1.8, diy-0.1, php-5.3, perl-5.10) (required for creating an application)

From the above, it is obvious that in order to deploy a python based wsgi web application we need to create a OpenShift app with the catridge 'python-2.6' as follows:

$ rhc app create -t python-2.6 -a sampleapp

Though the OpenShift community has renamed wsgi-3.2 to python-2.6 in the command invocation, the app folder structure created still has a folder called wsgi, which is again a good candidate for confusion since, for catridges like php-5.3, perl-5.10, etc we get folders like php, perl, etc respectively in the app folder structure. For example, for the app created above we get the following folder structure:

data/  libs/  README  setup.py  wsgi/

On the other hand a php-5.3 catridge based app has the following folder structure:

data/  libs/  README  setup.py  php/

NOTE-1: We haven't supplied '-l' or '--rhlogin' option to the command above because it is already set for a default value in ~/.openshift/express.conf Following gives a sample configuration (this is same as your username in http://openshift.redhat.com/):

default_rhlogin = 'username@gmail.com'

NOTE-2: The old form of rhc commands which had individual commands for operation like 'rhc-create-app' will be deprecated in future. Instead we can do all the operations using the 'rhc' command by passing different option parameters like above.