-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpush-changes.html.md.erb
More file actions
51 lines (36 loc) · 1.35 KB
/
push-changes.html.md.erb
File metadata and controls
51 lines (36 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
---
title: Push Local Changes
owner: Tobias Fuhrimann
---
<strong><%= modified_date %></strong>
In this step you’ll learn how to propagate a local change to the application through to <%= vars.product_short %>. 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:
```python
# 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:
<pre class="terminal">
$ python app.py
</pre>
Visiting your application at <a href="http://localhost:3000" target="_blank">http://localhost:3000</a>, you should see the changed title. **You are awesome!**
Now deploy. All you need to do is `cf push` again:
<pre class="terminal">
$ cf push my-python-app
</pre>
Finally, check that everything is working by visiting your app's URL from your web browser.
<div style="text-align:center;margin:3em;">
<a href="./environment.html" class="btn btn-primary">I can push local changes</a>
</div>