from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
# Pass in a puppy name
# We insert it to the html with jinja2 templates!
return '<h1> Go to /puppy/name </h1>'
@app.route('/puppy/<name>')
def puppy_name(name):
# Pass in a puppy name
# We insert it to the html with jinja2 templates!
return render_template('filter.html',name=name)
if __name__ == '__main__':
app.run(debug=True)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<h1>We can apply a variety of filters</h1>
<h1>Capitalize {{name|capitalize}}</h1>
<h1>Lower {{name|lower}}</h1>
<h1>Upper {{name|rufus}}</h1>
{# List of possible filters #}
{# http://jinja.pocoo.org/docs/2.10/templates/#builtin-filters #}
</body>
</html>