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.")
评论列表
文章目录