[BUG] External assets not reflected in get_asset_url #1527
Closed
Description
When serving assets from an external path by setting:
serve_locally=False
and
assets_external_path=<url to external asset folder>
css, js, and favicon assets are pulled from the external asset directory when the app is initialized, but if I try to use app.get_asset_url(<asset>)
it still pulls the asset from the dash directory rather than the external directory.
Would developers be ammenable to a pull request altering the get_asset_url function to look more like below?
def get_asset_url(self, path):
if self.config.assets_external_path:
asset = get_asset_path(
self.config.assets_external_path,
path,
self.config.assets_url_path.lstrip("/"),
)
else:
asset = get_asset_path(
self.config.requests_pathname_prefix,
path,
self.config.assets_url_path.lstrip("/"),
)
return asset
For reference get_asset_path is defined in _utils.py as:
def get_asset_path(requests_pathname, asset_path, asset_url_path):
return "/".join(
[
# Only take the first part of the pathname
requests_pathname.rstrip("/"),
asset_url_path,
asset_path,
]
)