Tools for Python Apps on OpenShift Red Hat Cloud
Project description
# shiftpy
Tools for running Python Apps on OpenShift Red Hat Cloud
[![Build Status](https://travis-ci.org/rochacbruno/shiftpy.svg?branch=master)](https://travis-ci.org/rochacbruno/shiftpy)
[![Code Health](https://landscape.io/github/rochacbruno/shiftpy/master/landscape.svg?style=flat)](https://landscape.io/github/rochacbruno/shiftpy/master)
<a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=rochacbruno%40gmail%2ecom&lc=BR&item_name=ShiftPy&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest"><img alt='Donate with Paypal' src='http://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif' /></a>
# 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
```python
> from shiftpy.env import getvar
> print getvar('HOMEDIR')
'app-root/w543543543543543/home/'
```
# listvars
```python
> from shiftpy.env import listvars
> listvars()
OPENSHIFT_HOMEDIR = 'app-root/w543543543543543/home/'
OPENSHIFT_APP_NAME = 'yourappname'
...
```
# getallvars
```python
> 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
```python
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
Tools for running Python Apps on OpenShift Red Hat Cloud
[![Build Status](https://travis-ci.org/rochacbruno/shiftpy.svg?branch=master)](https://travis-ci.org/rochacbruno/shiftpy)
[![Code Health](https://landscape.io/github/rochacbruno/shiftpy/master/landscape.svg?style=flat)](https://landscape.io/github/rochacbruno/shiftpy/master)
<a target="_blank" href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=rochacbruno%40gmail%2ecom&lc=BR&item_name=ShiftPy&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHostedGuest"><img alt='Donate with Paypal' src='http://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif' /></a>
# 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
```python
> from shiftpy.env import getvar
> print getvar('HOMEDIR')
'app-root/w543543543543543/home/'
```
# listvars
```python
> from shiftpy.env import listvars
> listvars()
OPENSHIFT_HOMEDIR = 'app-root/w543543543543543/home/'
OPENSHIFT_APP_NAME = 'yourappname'
...
```
# getallvars
```python
> 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
```python
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
shiftpy-0.1.2.tar.gz
(2.9 kB
view details)
File details
Details for the file shiftpy-0.1.2.tar.gz
.
File metadata
- Download URL: shiftpy-0.1.2.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 112c15c6db8686d3ecbf25a0d999d772c98012f229033fd8586dfd81114005ec |
|
MD5 | 4b6e502fa0e3b993a3022fda811f39f9 |
|
BLAKE2b-256 | d3b9be02765c90ac9ba242a536fda4b974a2db9e1241903f8b2b9e2193a10b61 |