I'm looking to install www.planetplanet.org in openshift. I've hosted a few php apps on openshift, but am not sure how python apps work. The openshift template gives me a wsgi.py file, which needs the 'application' module / function as its starting point. I'm not sure where to point it to. The planetplanet code layout is here and my suspicion is I have to point the 'application' to planet/init.py. No idea though how to do it.

While searching, I came across https://github.com/shekhargulati/schedapp-openshift which is a simple python app on openshift, which has this line in its wsgi.py:

from sched.app import app as application, db

But planetplanet doesn't seem to be a module that can be loaded in such a way.

I tried:

from planet.planet import planet as application

but that fails with this message on the server:

ImportError: No module named planet.planet

EDIT: I found planetplanet just dumps a static index.html in my output directory, so I now just need to ensure wsgi application points to my output dir to serve the html.

Any pointers / advice?



So I did something like this:

response_body = open(os.environ['OPENSHIFT_REPO_DIR'] + 'planet/virt/output/index.html').read()

in the default

def application

part of the wsgi.py script. That got the static html to work, but obviously without css.

But then I discovered openshift provides the python binary in non-python apps as well, so I just created a DIY application, imported the planetplanet sources, and used the python in the cron script to update the feeds; and the default testrubyserver.rb in the diy/ dir to serve the index.html.


in the default def application add

ctype = 'text/html'

Important : don't not forget 'text/html' return type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.