forked from orbit-oss/flask
Edited variable names in quickstart guide (#5487)
This commit is contained in:
commit
bb16048ad7
1 changed files with 4 additions and 4 deletions
|
|
@ -375,7 +375,7 @@ Here's a simple example of how to render a template::
|
||||||
@app.route('/hello/')
|
@app.route('/hello/')
|
||||||
@app.route('/hello/<name>')
|
@app.route('/hello/<name>')
|
||||||
def hello(name=None):
|
def hello(name=None):
|
||||||
return render_template('hello.html', name=name)
|
return render_template('hello.html', person=name)
|
||||||
|
|
||||||
Flask will look for templates in the :file:`templates` folder. So if your
|
Flask will look for templates in the :file:`templates` folder. So if your
|
||||||
application is a module, this folder is next to that module, if it's a
|
application is a module, this folder is next to that module, if it's a
|
||||||
|
|
@ -404,8 +404,8 @@ Here is an example template:
|
||||||
|
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<title>Hello from Flask</title>
|
<title>Hello from Flask</title>
|
||||||
{% if name %}
|
{% if person %}
|
||||||
<h1>Hello {{ name }}!</h1>
|
<h1>Hello {{ person }}!</h1>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h1>Hello, World!</h1>
|
<h1>Hello, World!</h1>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
@ -419,7 +419,7 @@ know how that works, see :doc:`patterns/templateinheritance`. Basically
|
||||||
template inheritance makes it possible to keep certain elements on each
|
template inheritance makes it possible to keep certain elements on each
|
||||||
page (like header, navigation and footer).
|
page (like header, navigation and footer).
|
||||||
|
|
||||||
Automatic escaping is enabled, so if ``name`` contains HTML it will be escaped
|
Automatic escaping is enabled, so if ``person`` contains HTML it will be escaped
|
||||||
automatically. If you can trust a variable and you know that it will be
|
automatically. If you can trust a variable and you know that it will be
|
||||||
safe HTML (for example because it came from a module that converts wiki
|
safe HTML (for example because it came from a module that converts wiki
|
||||||
markup to HTML) you can mark it as safe by using the
|
markup to HTML) you can mark it as safe by using the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue