templating.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:isni-reconcile 作者: cmh2166 项目源码 文件源码
def test_custom_template_loader(self):
        class MyFlask(flask.Flask):
            def create_global_jinja_loader(self):
                from jinja2 import DictLoader
                return DictLoader({'index.html': 'Hello Custom World!'})
        app = MyFlask(__name__)
        @app.route('/')
        def index():
            return flask.render_template('index.html')
        c = app.test_client()
        rv = c.get('/')
        self.assert_equal(rv.data, b'Hello Custom World!')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号