Repository: plotly/dash

Issue:
assets_url_path is broken.
Changing the `assets_url_path` breaks the assets includes, they are still requesting `/assets/` instead of the changed `assets_url_path`.


Discussion:

Resolving patch:
diff --git a/dash/_utils.py b/dash/_utils.py
--- a/dash/_utils.py
+++ b/dash/_utils.py
@@ -20,14 +20,19 @@ def format_tag(tag_name, attributes, inner='', closed=False, opened=False):
             '{}="{}"'.format(k, v) for k, v in attributes.items()]))
 
 
-def get_asset_path(requests_pathname, routes_pathname, asset_path):
+def get_asset_path(
+        requests_pathname,
+        routes_pathname,
+        asset_path,
+        asset_url_path):
+
     i = requests_pathname.rfind(routes_pathname)
     req = requests_pathname[:i]
 
     return '/'.join([
         # Only take the first part of the pathname
         req,
-        'assets',
+        asset_url_path,
         asset_path
     ])
 
diff --git a/dash/dash.py b/dash/dash.py
--- a/dash/dash.py
+++ b/dash/dash.py
@@ -101,6 +101,7 @@ def __init__(
         self._assets_folder = assets_folder or os.path.join(
             flask.helpers.get_root_path(name), 'assets'
         )
+        self._assets_url_path = assets_url_path
 
         # allow users to supply their own flask server
         self.server = server or Flask(name, static_folder=static_folder)
@@ -944,10 +945,14 @@ def add_resource(p, filepath):
                     self._favicon = path
 
     def get_asset_url(self, path):
-        return _get_asset_path(
+        asset = _get_asset_path(
             self.config.requests_pathname_prefix,
             self.config.routes_pathname_prefix,
-            path)
+            path,
+            self._assets_url_path.lstrip('/')
+        )
+
+        return asset
 
     def run_server(self,
                    port=8050,
diff --git a/dash/version.py b/dash/version.py
--- a/dash/version.py
+++ b/dash/version.py
@@ -1 +1 @@
-__version__ = '0.26.4'
+__version__ = '0.26.5'


Test patch:
diff --git a/tests/test_configs.py b/tests/test_configs.py
--- a/tests/test_configs.py
+++ b/tests/test_configs.py
@@ -92,16 +92,16 @@ def test_pathname_prefix_environ_requests(self):
     def test_pathname_prefix_assets(self):
         req = '/'
         routes = '/'
-        path = get_asset_path(req, routes, 'reset.css')
+        path = get_asset_path(req, routes, 'reset.css', 'assets')
         self.assertEqual('/assets/reset.css', path)
 
         req = '/requests/'
-        path = get_asset_path(req, routes, 'reset.css')
+        path = get_asset_path(req, routes, 'reset.css', 'assets')
         self.assertEqual('/requests/assets/reset.css', path)
 
         req = '/requests/routes/'
         routes = '/routes/'
-        path = get_asset_path(req, routes, 'reset.css')
+        path = get_asset_path(req, routes, 'reset.css', 'assets')
         self.assertEqual('/requests/assets/reset.css', path)
 
 
diff --git a/tests/test_integration.py b/tests/test_integration.py
--- a/tests/test_integration.py
+++ b/tests/test_integration.py
@@ -363,7 +363,9 @@ def test_index_customization(self):
         self.percy_snapshot('custom-index')
 
     def test_assets(self):
-        app = dash.Dash(assets_folder='tests/assets',
+        app = dash.Dash(__name__,
+                        assets_folder='tests/assets',
+                        assets_url_path='/test-assets',
                         assets_ignore='.*ignored.*')
         app.index_string = '''
         <!DOCTYPE html>