Why can't Mako find a template next to the one that includes it?

Ok, by running this in python:

from mako.lookup import TemplateLookup
from mako.template import Template
mylookup = TemplateLookup(directories=['/home/user/webapps/app/www/templates/'])
mytemplate = Template(filename='/home/user/webapps/app/www/templates/content.html.mako', lookup=mylookup)
print (mytemplate.render(title="Title", content={'hi'}))

      

When will it start content.html.mako

## content.html.mako
<%inherit file="frame.html.mako"/>

      

Gives me this:

mako.exceptions.TemplateLookupException: Cant locate template for uri '/home/user/webapps/app/www/templates/frame.html.mako'

      

But it frame.html.mako

's in the same directory as, what content.html.mako

's going on here?

+3


source to share


1 answer


After posting this file, I found that it works if the 4th line mytemplate = mylookup.get_template('content.html.mako')

.



+5


source







All Articles