Cherrypy的Mako模板支持。
marbaloo_mako的Python项目详细描述
Mako对cherrypy的模板支持。
安装
pip install marbaloo_mako
用法
# templates/dir1/index.mak <h1>Today: ${today}</h1>
# app.py import os import marbaloo_mako import cherrypy from datetime import date cherrypy.tools.mako = marbaloo_mako.Tool() class Root(object): @cherrypy.expose @cherrypy.tools.mako(filename='/index.mak') def simple(self): return {'today': date.today()} root_path = os.path.dirname(__file__) cherrypy.quickstart(Root(), '/', { '/': { 'tools.mako.on': True, 'tools.mako.directories': [os.path.join(root_path, 'templates/dir1')] } })