You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/scenarios/web.rst
+16-11Lines changed: 16 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ WSGI is documented in :pep:`3333`.
24
24
Frameworks
25
25
::::::::::
26
26
27
-
Broadly speaking, a web framework consist of a set of libraries and a main
27
+
Broadly speaking, a web framework consists of a set of libraries and a main
28
28
handler within which you can build custom code to implement a web application
29
29
(i.e. an interactive web site). Most web frameworks include patterns and
30
30
utilities to accomplish at least the following:
@@ -280,15 +280,15 @@ and to the templates themselves.
280
280
281
281
- Template files should be passed only the dynamic
282
282
content that is needed for rendering the template. Avoid
283
-
to be tempted to pass additional content "just in case":
283
+
the temptation to pass additional content "just in case":
284
284
it is easier to add some missing variable when needed than to remove
285
285
a likely unused variable later.
286
286
287
287
- Many template engines allow for complex statements
288
288
or assignments in the template itself, and many
289
289
allow some Python code to be evaluated in the
290
290
templates. This convenience can lead to uncontrolled
291
-
increase in complexity, and often harder to find bugs.
291
+
increase in complexity, and often make it harder to find bugs.
292
292
293
293
- It is often necessary to mix JavaScript templates with
294
294
HTML templates. A sane approach to this design is to isolate
@@ -299,9 +299,12 @@ and to the templates themselves.
299
299
300
300
Jinja2
301
301
------
302
-
`Jinja2 <http://jinja.pocoo.org/>`_ is a template engine which is similar to the Django template system with some extra features. It is a text-based template
303
-
language and thus can be used to generate any markup. It allows customization of filters, tags, tests and globals.
304
-
Unlike the template system implemented in the Django Framework it allows to call functions. The Code is staying under the BSD license.
302
+
`Jinja2 <http://jinja.pocoo.org/>`_ is a template engine which is similar to
303
+
the Django template system with some extra features. It is a text-based
304
+
template language and thus can be used to generate any markup. It allows
305
+
customization of filters, tags, tests and globals, and unlike the template
306
+
system implemented in the Django Framework, also allows calling functions.
307
+
Jinja2 is released under the BSD license.
305
308
306
309
Here some important html tags in Jinja2:
307
310
@@ -324,8 +327,8 @@ Here some important html tags in Jinja2:
324
327
325
328
326
329
327
-
The next listings is an example of a web site in combination with the tornado web server. Tornado is not very complicate
328
-
to use.
330
+
The next listings is an example of a web site in combination with the tornado
331
+
web server. Tornado is not very complicate to use.
329
332
330
333
.. code-block:: python
331
334
@@ -365,7 +368,8 @@ to use.
365
368
application.listen(PORT)
366
369
tornado.ioloop.IOLoop.instance().start()
367
370
368
-
The :file:`base.html` file can be used as base for all site pages which are for example implemented in the content block.
371
+
The :file:`base.html` file can be used as base for all site pages which are
372
+
for example implemented in the content block.
369
373
370
374
.. code-block:: html
371
375
@@ -389,8 +393,9 @@ The :file:`base.html` file can be used as base for all site pages which are for
389
393
</body>
390
394
391
395
392
-
The next listing is our site page (:file:`site.html`) loaded in the Python app which extends :file:`base.html`. The content block is
393
-
automatically set into the corresponding block in the :file:`base.html` page.
396
+
The next listing is our site page (:file:`site.html`) loaded in the Python
397
+
app which extends :file:`base.html`. The content block is automatically set
398
+
into the corresponding block in the :file:`base.html` page.
0 commit comments