endamaco
endamaco

Reputation: 163

Running Flask App on OpenShift 3.5

I'm trying to run a very easy flask app with my OpenShift demo account. I created a file app.py with its content as:

from flask import Flask
application = Flask(__name__)

@application.route("/")
def hello():
    return "Hello World!"

if __name__ == "__main__":
    application.run()

I pushed it to my git and a build has been triggered. The log in openshift seems Ok but when I hit my URL (as read in the home dashboard) http://my-app.starter-us-east-1.openshiftapps.com I just get the errore saying "Application is not available" .

Should I configure something else?

Upvotes: 1

Views: 1039

Answers (1)

Graham Dumpleton
Graham Dumpleton

Reputation: 58523

Your application must use port 8080.

By default the Flask development server listens on port 5000.

So use:

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080)

Upvotes: 3

Related Questions