├── peak.py
└── templates
└── index.html
/peak.py:
--------------------------------------------------------------------------------
1 | from flask import Flask, render_template
2 |
3 | app = Flask(__name__)
4 |
5 |
6 | @app.route('/')
7 | def index():
8 | mountains = ['Everest', 'K2', 'Kilimanjaro']
9 | return render_template('index.html', mountain=mountains)
10 |
11 | @app.route('/mountain/')
12 | def mountain(mt):
13 | return "This is " + str(mt)
14 |
15 | if __name__ == "__main__":
16 | app.run(host='0.0.0.0', port=5000)
17 |
--------------------------------------------------------------------------------
/templates/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | Let's go climb a mountain!
4 |
5 | {% for mt in mountain %}
6 | - {{ mt }}
7 | {% endfor %}
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------