Push Local Changes

Page last updated:

Page last updated:

In this step you’ll learn how to propagate a local change to the application through to Cloud Foundry. As a simple change, we’ll modify the title which the app shows.

Change the return property in the app.py file to ‘I am awesome!’. Your final result should look something like this:

# import dependencies
import os
from flask import Flask

# bootstrap the app
app = Flask(__name__)

# set the port dynamically with a default of 3000 for local development
port = int(os.getenv('PORT', '3000'))

# our base route which just returns a string
@app.route('/')
def hello_world():
    return 'I am awesome!'

# start the app
if __name__ == '__main__':
    app.run(host='0.0.0.0', port=port)

Now test locally:

$ python app.py

Visiting your application at http://localhost:3000, you should see the changed title. You are awesome!

Now deploy. All you need to do is cf push again:

$ cf push my-python-app

Finally, check that everything is working by visiting your app’s URL from your web browser.

I can push local changes
View the source for this page in GitHub