holoviz / panel

Panel: The powerful data exploration & web app framework for Python
https://panel.holoviz.org
BSD 3-Clause "New" or "Revised" License
4.79k stars 518 forks source link

Serving static assets in an offline .html file #1426

Open LeonvanKouwen opened 4 years ago

LeonvanKouwen commented 4 years ago

In practice I find sharing a panel dashboard via an stand-alone html file very useful. Even if the dashboard requires an active python kernel, sharing a snapshot with responsive graphs is very nice. This applies in particular when you work with restricted data and/or when working with non-techies. There is already functionality for this, but this lacks serving static assets.

Describe the solution you'd like

The following code could is available

my_panel.save('index.html')

This could be extended like so:

my_panel.save('index.html', static_dirs={'custom_static': './examples'})

such that the saved html also includes references to the static files. The output is a html file that refers to static assets in the same directory.

It is already possible to inline the panel/bokeh resources:

from bokeh.resources import INLINE
my_panel.save('index.html', resources=INLINE)

It would be nice if this also inlined the custom resources.

This is basically an extension to this issue

Describe alternatives you've considered

I have cut and paste code in the html and this made it work. This shows there is no fundamental issue, but it is not very convenient of course.

Niko-La commented 2 years ago

is there a way to get statci html page of a dashboard? have the dashboard working fine using panel serve --show demo.ipynb looking to host using netlify or vercel etc.