OpenShift tools for running Python Apps on OpenShift Red Hat Cloud
Python Makefile
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
shiftpy
tests
.gitignore
.landscape.yaml
.travis.yml
LICENSE
MANIFEST.in
Makefile
README.md
requirements.txt
setup.py

README.md

shiftpy

Tools for running Python Apps on OpenShift Red Hat Cloud

Build Status Code Health

Donate with Paypal

installation

pip install shiftpy

Available tools

  • env.getvar - Get openshift env var
  • env.listvars - Print all openshift env vars
  • env.getallvars - Get all vars as a dict
  • wsgi_utils.envify - Wrap wsgi app in Openshift Virtualenv
  • ADD YOURS, please contribute

getvar

> from shiftpy.env import getvar
> print getvar('HOMEDIR')
'app-root/w543543543543543/home/'

listvars

> from shiftpy.env import listvars
> listvars()
OPENSHIFT_HOMEDIR = 'app-root/w543543543543543/home/'
OPENSHIFT_APP_NAME = 'yourappname'
...

getallvars

> from shiftpy.env import getallvars
> allvars = getallvars()
> print allvars
{'OPENSHIFT_FOO': 'BAR',
 'OPENSHIFT_HOMEDIR': '/tmp',
 'OPENSHIFT_PYTHON_DIR': '/tmp/python'}

envify

This will wrap your wsgi app in virtualenv to OpenShift

from shiftpy.wsgi_utils import envify
from myproject import app

# wsgi expects an object named 'application'
application = envify(app)

then your app will be available for wsgi_mod and virtualenv is activated