Just a quick tip about a problem I ran into with Mako recently. When it creates the cache directory for compiled template files, it sets the directory’s permissions to rwx——. This will cause a problem if you use a constant cache directory like the Mako documentation, because only the first user to run the program will have access to the compiled templates.

To get around this, be sure to use a unique cache directory for each user. On Linux, you can append the effective user id to the cache directory name like this:

CACHE_DIR = '/tmp/mako'

# ...

module_directory = '%s-%s' % (CACHE_DIR, os.geteuid())