4

I have a look at the source code of these two template engines, and the Jinja2 has over 10000 lines of code, while the tornado template just has less than 1000 lines of code.

When you have a simple usage case, their syntax is almost the same:

{% extends "base.html" %}

{% block title %}A bolder title{% end %}

{% block student %}
<li><span style="bold">{{ student.name }}</span></li>
{% end %}

So why Jinja2 has that much code, what is the difference that causes it? And which one is faster?

fengsp
  • 1,035
  • 1
  • 11
  • 19

1 Answers1

0

The main difference is: Tornado templating is part of the Tornado webserver. Jinja is a templating engine with a lot of features, which can be used by other WSGI web frameworks.

So the question is: Do you use a Tornado webserver. Do you use a WSGI web framework or a non-blocking web framework like Tornado.

See als this question: Differences between node.js and Tornado

Community
  • 1
  • 1
voscausa
  • 11,253
  • 2
  • 39
  • 67
  • 4
    Tornado's template system is not packaged separately (or documented very well), but you can use it without touching Tornado's http-serving components. So you could use tornado templates from any other framework or server if you want to. – Ben Darnell Aug 29 '14 at 17:27