1from flask import render_template
2
3@app.route('/hello/')
4@app.route('/hello/<name>')
5def hello(name=None):
6 return render_template('hello.html', name=name)
7
8---------------------------------------------------
9<!doctype html>
10<title>Hello from Flask</title>
11{% if name %}
12 <h1>Hello {{ name }}!</h1>
13{% else %}
14 <h1>Hello, World!</h1>
15{% endif %}
16