这个确切的用例恰好是flask的
open_resourceAPI调用文档以及问题中链接的蓝图文档中使用的示例。
具体来说,参考文档说:
若要查看其工作原理,请考虑以下文件夹结构:
/myapplication.py /schema.sql /static /style.css /templates /layout.html /index.html
如果要打开schema.sql文件,请执行以下操作:
with app.open_resource('schema.sql') as f: contents = f.read() do_something_with(contents)


