Mako

Mako是一个Python语言内置的模板引擎。

Mako template engine logo.

Mako资源

  • Exploring Mako explains a bit about the template engines Myghty and Mason, which influenced Mako’s design. The post then shows a few basic examples for how to use Mako.
  • Configuration Templates with Python and Mako shows some basic situations for how to use Mako in an example project.
  • The Pylons’ project documentation on templates provides many examples for using Mako, which is the default template language for the Pylons web framework.
  • Flask-Mako is a Flask extension that makes it easier to use Mako as the template engine in your Flask web app projects.
  • The Stack Overflow question on What is the fastest template system for Python? provides some basic benchmarks comparing Mako, Jinja and other template engines. Any benchmark should be taken as a data point rather than a rule on which engine is actually the fastest in real world scenarios. In addition, if you are using Mako or any other template engine as part of a static website generator then it will not really matter which one is the fastest because the output is created before the website is deployed rather than during the web server‘s HTTP request-response cycle.