简体   繁体   中英

Tornado Templating with {% code %} {% end %}

Is there any option to extend the tornado web template with the option inside the html template

{% code %}
  # Python code
{% end %}

No, there is no such option. Tornado's templates are fairly liberal in allowing python code directly in the template, especially with the {% set %} directive (which can include any single-line statement, not just a variable assignment), but it is not possible to use multi-line statements except for the ones that have corresponding template directives ( {% for %} , {% if %} , {% try %} , and {% while %} )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM