assets.py 文件源码

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

项目:djaio 作者: Sberned 项目源码 文件源码
def _set_asset_paths(self, app):
        """
        Read in the manifest json file which acts as a manifest for assets.
        This allows us to get the asset path as well as hashed names.

        :param app: aiohttp application
        :return: None
        """
        webpack_stats = app.settings.WEBPACK_MANIFEST_PATH

        try:
            with open(webpack_stats, 'r') as stats_json:
                stats = json.load(stats_json)
                if app.settings.WEBPACK_ASSETS_URL:
                    self.assets_url = app.settings.WEBPACK_ASSETS_URL
                else:
                    self.assets_url = stats['publicPath']

                self.assets = stats['assets']
        except IOError:
            raise RuntimeError(
                "'WEBPACK_MANIFEST_PATH' is required to be set and "
                "it must point to a valid json file.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号