The OpenShift forums have been retired.
You can still read and search them, but for help, please visit

Help getting Flask running on Python 2.7 Community version


I have an existing Flask application with it's own layout and a lot of code. I wanted to deploy it to OpenShift, but I'm running Python 2.7. I installed the cartridge for Python 2.7 Community Edition, but although I'm able to run the test app (displaying a static page), I have not been able to run Flask, even it runs on WSGI locally.

Do I need to move all my code into the "magic" wsgi/ director?

I am currently running: run_gevent_server(app, ip, port)

where ip and port are the OPENSHIFT_INTERNAL_IP and where app is a reference to my main flask It works when I run gevent locally. But when I deploy, I get 503 from the server, and I cannot find any logs showing what happened.

Any guidance is much appreciated!

Regards, Martin

Here is a simple flask quickstart that you can look at -

Great, after some hacking, that did it!

But can I ask - the example app contains a wsgi/ directory and what seems to be a dummy file there, but the Flask is run form in the main dir. Do I still need the wsgi/ dir? What's the exact command OpenShift runs to start the Flask app?

Thanks in any case!

We are just running in this case so you could modify it to not use wsgi/application.