首页 > 解决方案 > Mako 顶级查找异常

问题描述

我必须在我的 mako 模板中包含 css。我尝试了此示例代码,但出现此错误,我不知道为什么?

第 262 行,在 get_template 中引发 exceptions.TopLevelLookupException( mako.exceptions.TopLevelLookupException: Cant locate template for uri 'table_design'

lookup = TemplateLookup(directories=['.', '/Programs/Python/Python39/templates'])

try:
    template = lookup.get_template('table_design.css')
    print(template.render())
except:
    print(exceptions.text_error_template().render()) 

标签: pythonhtmlcssmako

解决方案


推荐阅读