Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a Python Openshift run a certain python file?

Tags:

openshift

I would like to run a certain python file whenever the OpenShift app starts. I have tried many things, like in the wsgi.py file running execfile("thefilename.py") which didn't work!

I was hoping to get some help with this! Thanks so much!

like image 947
I an Oxy Moron Avatar asked Nov 09 '22 17:11

I an Oxy Moron


1 Answers

Running from a bash script.

#!/bin/bash

export LD_LIBRARY_PATH="/opt/rh/python33/root/usr/lib64"
export PATH="/var/lib/openshift/<your ssh id>/python//virtenv/venv/bin:/var/lib/openshift/<your ssh id>/python//bin:/opt/rh/python33/root/usr/bin:/bin:/usr/bin:/usr/sbin"
source ${VIRTUAL_ENV}/bin/activate
python pathtofile/yourfile.py
like image 72
fat fantasma Avatar answered Dec 28 '22 08:12

fat fantasma