python - 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())
解决方案
推荐阅读
- sql - 在没有搜索 id 的兄弟姐妹的情况下,在 SQL 中获取直接层次结构
- c++ - 使用私有变量获取正确值时遇到问题
- android - 我如何在代码中自己调用内容提供者?
- php - Laravel - 将收集数据复制到另一个表并删除
- react-native - FlatList:检测滚动后何时到达顶部
- django - 没有提示在 Django 的身份验证系统上设置超级用户?
- python - 如何使用 Beautifulsoup 提取电子邮件文本?
- ios - 正在发送测试 FCM-PN 但未收到云功能生成的推送通知(适用于 Android 等效项)
- c++ - 为什么 std::getline() 的结果不符合预期
- javascript - AR.js 显示挂在墙上的 png