1. dgc
  2. makomate

Overview

There is one good thing about PHP: that in any PHP document, you can intermingle HTML and PHP code together, at will, effectively making your HTML document itself the application. This isn't always the right approach, of course, but it is quite powerful and it can be a useful technique for small projects, rapid prototyping, or simply for adding logic into a standing document.

Python Server Pages (PSP) sort of offered the same thing, though not really quite as nice. But PSP has fallen by the wayside with the demise of mod_python and the ascension of WSGI.

What, then, to do? You can find nice Python templating engines out there, such as Mako, Jenji, Django, etc. But you still need to devise an something to drive the rendering and presentation of your templates. You still need to write a separate application.

Makomate is a small WSGI application that can be used in this role, but moreover it's suitable for use as a default document handler. By aliasing a URI (that is, by using Apache's Alias directive) to makomate, you direct Apache to let makomate resolve all document requests rooted at that URI. It does so by searching for suitable template files on your filesystem, loading them, rendering them, and delivering the product. The result is a single WSGI application that with a handful of Apache configuration lines gives you that same power and flexibility that PHP has, without the horror of PHP.