Mako

Mako is a template engine built in Python that is used to generate output HTML, XML and similar formats.

Mako template engine logo.

Mako is an implementation of the template engines concept. Learn more in the web development chapter or view the table of contents for all topics.

Mako resources

  • 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.

  • 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.

Learn more about template engines or another topic?

What are template engines and why are they useful?

I want to learn how to code a Python web application using a framework.

I've built a Python web app, now how do I deploy it?


Matt Makai 2012-2022