from flask import Flask, render_template, request
import redis
app = Flask(__name__)
r = redis.StrictRedis(host='127.0.0.1', port=6379, db=0)

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/', methods=['POST'])
def post():
    weight = float(request.form['weight'])
    height = float(request.form['height'])
    if weight == ''and height == '':
        return "You must enter a weight and a height."
    elif weight == '':
        return "You must enter a weight."
    elif height == '':
        return "You must enter a height."
    else:
        print request.form
        print type(weight)
        print type(height)
        bmi = (weight * 703)/(height**2)
        print type(bmi)
        r.set('rw', weight)
        r.set('rh', height)
        r.set('rbmi', bmi)

        # return "You entered " + weight + " and " + height + " and your BMI is " + bmi + "."
        return "Your BMI is {0}".format(bmi)

if __name__ == '__main__':
    app.run(debug=True)
    
@@ -56,16 +56,27 @@
 t redis%0A
+import os%0A%0A
 app = Fl
@@ -987,16 +987,88 @@
     
-app.run(
+port = int(os.environ.get(%22POST%22, 5000))%0A    app.run(host='0.0.0.0', port=port, 
 debu
@@ -1075,12 +1075,9 @@
 g=True)%0A
-    
+%0A

Fix master for deployment