flask_assets.py 文件源码

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

项目:WhatTheHack 作者: Sylphias 项目源码 文件源码
def load_from_templates(self, env, jinja_extension):
            from webassets.ext.jinja2 import Jinja2Loader, AssetsExtension
            from flask import current_app as app

            # Use the application's Jinja environment to parse
            jinja2_env = app.jinja_env

            # Get the template directories of app and blueprints
            template_dirs = [path.join(app.root_path, app.template_folder)]
            for blueprint in app.blueprints.values():
                if blueprint.template_folder is None:
                    continue
                template_dirs.append(
                    path.join(blueprint.root_path, blueprint.template_folder))

            return Jinja2Loader(env, template_dirs, [jinja2_env], jinja_ext=jinja_extension).\
                load_bundles()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号