Is there any way to save panel template app as a HTML?
like:
panel.save('test.html')
but for template layout, something like:
bootstrap.save('test.html')
Is there any way to save panel template app as a HTML?
like:
panel.save('test.html')
but for template layout, something like:
bootstrap.save('test.html')
Hi @bigsmile,
The code snippet below might be something you’re looking for. I am using this to download “a section of a tab of an app”, if that makes sense. Let me know if you need further explanation.
from io import BytesIO
def dl_perf():
try:
b = BytesIO()
pn.panel(tab1_main).save(b)
b.seek(0)
return b
except:
pass
button_dl_perf = pn.widgets.FileDownload(callback=dl_perf, filename='perf.html', button_type='primary')
It’s not what I mean, I want to know if I can have html of whole of app with template and not each part
Think of this app https://awesome-panel.org/classic-dashboard how to have html of this instead of serverable() ?(whole stuff with template as one html file)
Just had a look at home and couldn’t figure it out, so I’d be interested as well if anybody wants to contribute.
At the same time there’s a way to save your whole material.main object, meaning you won’t have a header or sidebar, but everything else including CSS.
A simple example. Let’s suppose your app is made of one column as per below…
mat_main = pn.Column(a, b, c, d, download_button)
material.main.append(mat_main)
Then you can use the method from my other reply with pn.panel(mat_main).save(b)
and as you probably can guess the download button will be visible in the saved html file as well.
I would also like to be able to add a Download
or Save
button to my apps using the templates. I see that there is a feature request for this here Add .save() method to Template class · Issue #1066 · holoviz/panel (github.com).