@@ -270,12 +270,11 @@ dynamic content to the template engine, and to the templates themselves.
270
270
271
271
Jinja2
272
272
------
273
- `Jinja2 <http://jinja.pocoo.org/ >`_ is a template engine which is similar to
274
- the Django template system with some extra features. It is a text-based
275
- template language and thus can be used to generate any markup. It allows
276
- customization of filters, tags, tests and globals, and unlike the template
277
- system implemented in the Django Framework, also allows calling functions.
278
- Jinja2 is released under the BSD license.
273
+ `Jinja2 <http://jinja.pocoo.org/ >`_ is a very well-regarded template engine.
274
+
275
+ It uses a text-based template language and can thus be used to generate any
276
+ type markup, not just HTML. It allows customization of filters, tags, tests
277
+ and globals. It features many improvements over Django's templating system.
279
278
280
279
Here some important html tags in Jinja2:
281
280
@@ -297,7 +296,6 @@ Here some important html tags in Jinja2:
297
296
{% endfor %}
298
297
299
298
300
-
301
299
The next listings is an example of a web site in combination with the Tornado
302
300
web server. Tornado is not very complicated to use.
303
301
@@ -385,8 +383,12 @@ into the corresponding block in the :file:`base.html` page.
385
383
</p >
386
384
{% endblock %}
387
385
386
+
387
+ Jinja2 is the recommended templating library for new Python web applications.
388
+
388
389
Chameleon
389
390
---------
391
+
390
392
`Chameleon <https://chameleon.readthedocs.org/ >`_ Page Templates are an HTML/XML template
391
393
engine implementation of the `Template Attribute Language (TAL) <http://en.wikipedia.org/wiki/Template_Attribute_Language >`_,
392
394
`TAL Expression Syntax (TALES) <http://chameleon.readthedocs.org/en/latest/reference.html#expressions-tales >`_,
@@ -445,8 +447,11 @@ you can replace it with a more terse and readable syntax that uses the pattern
445
447
But keep in mind that the full `<span tal:replace="expression">Default Text</span> `
446
448
syntax also allows for default content in the unrendered template.
447
449
450
+ Being from the Pyramid world, Chameleon is not widely used.
451
+
448
452
Mako
449
453
----
454
+
450
455
`Mako <http://www.makotemplates.org/ >`_ is a template language that compiles to Python
451
456
for maximum performance. Its syntax and api is borrowed from the best parts of other
452
457
templating languages like Django and Jinja2 templates. It is the default template
@@ -482,6 +487,8 @@ To render a very basic template, you can do the following:
482
487
from mako.template import Template
483
488
print (Template(" hello ${data} !" ).render(data = " world" ))
484
489
490
+ Mako is well respected within the Python web community.
491
+
485
492
.. rubric :: References
486
493
487
494
.. [1 ] `The mod_python project is now officially dead <http://blog.dscpl.com.au/2010/06/modpython-project-is-now-officially.html >`_
0 commit comments