from mako.lookup import TemplateLookup my_lookup = TemplateLookup(directories=['templates']) my_template = my_lookup.get_template('hello_world.html') rendered_template = my_template.render(name='John')
from mako.lookup import TemplateLookup my_lookup = TemplateLookup(directories=['templates'], module_directory='cache') # Load my_template1 from disk and cache it my_template1 = my_lookup.get_template('template1.html') # Load my_template2 from disk and cache it my_template2 = my_lookup.get_template('template2.html') # Use my_template1 and my_template2 as needed rendered1 = my_template1.render() rendered2 = my_template2.render()
pip install mako