Skip to content
Myr

Edited variable names in the rendering templates section of the quickstart guide.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jake Tanis · committed by David Lord · parent a2f495b · Browse files · 1 file+4 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−4 removed

  • other:+4 added−4 removed

1 file+4 added−4 removed

modified:docs/quickstart.rst+4 added-4 removed
373 unmodified lines
374375 @app.route('/hello/')376 @app.route('/hello/<name>')377 def hello(name=None):378 return render_template('hello.html', name=name)378 return render_template('hello.html', person=name)379380Flask will look for templates in the :file:`templates` folder. So if your381application is a module, this folder is next to that module, if it's a382package it's actually inside your package:
20 unmodified lines
403.. sourcecode:: html+jinja404405 <!doctype html>406 <title>Hello from Flask</title>407 {% if name %}408 <h1>Hello {{ name }}!</h1>407 {% if person %}408 <h1>Hello {{ person }}!</h1>409 {% else %}410 <h1>Hello, World!</h1>411 {% endif %}412
5 unmodified lines
418know how that works, see :doc:`patterns/templateinheritance`. Basically419template inheritance makes it possible to keep certain elements on each420page (like header, navigation and footer).421422Automatic escaping is enabled, so if ``name`` contains HTML it will be escaped422Automatic escaping is enabled, so if ``person`` contains HTML it will be escaped423automatically. If you can trust a variable and you know that it will be424safe HTML (for example because it came from a module that converts wiki425markup to HTML) you can mark it as safe by using the426:class:`~markupsafe.Markup` class or by using the ``|safe`` filter in the
481 unmodified lines