Skip to content

Commit

Permalink
fix local bundled paths for template resources (#1891)
Browse files Browse the repository at this point in the history
* fix local bundled paths for template resources

* replace app_url with state.base_url
  • Loading branch information
AjayThorve authored and philippjfr committed Jan 14, 2021
1 parent 6479e8c commit bf5e78b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion panel/template/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,9 @@ def _init_doc(self, doc=None, comm=None, title=None, notebook=False, location=Tr
def _template_resources(self):
name = type(self).__name__.lower()
resources = _settings.resources(default="server")
base_url = state.base_url[1:] if state.base_url.startswith('/') else state.base_url
if resources == 'server':
dist_path = urljoin(state.base_url, LOCAL_DIST)
dist_path = urljoin(base_url, LOCAL_DIST)
else:
dist_path = CDN_DIST

Expand Down
2 changes: 1 addition & 1 deletion panel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def bundled_files(model, file_type='javascript'):
filepath = url_path(url)
test_filepath = filepath.split('?')[0]
if resources == 'server' and os.path.isfile(os.path.join(bdir, test_filepath)):
files.append(f'/static/extensions/panel/bundled/{name}/{filepath}')
files.append(f'static/extensions/panel/bundled/{name}/{filepath}')
else:
files.append(url)
return files
Expand Down

0 comments on commit bf5e78b

Please sign in to comment.