I want to serve a panel entirely offline using the plotly extension.
The local bokeh server instance calls on two js sources from URLs when pn.extension('plotly')
is included in the script.
According to https://github.com/holoviz/panel/blob/master/panel/models/plotly.py these scripts are specified in the PlotlyPlot
class:
__javascript__ = ['https://cdn.plot.ly/plotly-latest.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js']
__js_require__ = {'paths': {'plotly': 'https://cdn.plot.ly/plotly-latest.min',
'lodash': 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min'},
'exports': {'plotly': 'Plotly',
'lodash': '_'}}
I was hoping that by simply saving the two source .js files locally (as plotly.js and lodash.js) and specifying these file locations in the panel.config
object, I would be able to serve the panel app with full functionality without the need for a internet connection. I,e.:
panel.config.js_files = {'plotly': 'C:\path\plotly.js',
'lodash': 'C:\path\lodash.js'}
However, a blank output is shown in a new browser tab when the .show()
method is run on the panel object when no internet connection is available. Inspecting the html of the blank app in the browser window the following script elements are present:
<script type="text/javascript" src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<style id="plotly.js-style-global"></style>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min.js"></script>
<script type="text/javascript" src="static/js/bokeh.min.js?v=547e7d2591695b654def5914bdd697fa"></script>
<script type="text/javascript" src="static/js/bokeh-widgets.min.js?v=423bf6bb32b8def8b6c9df74817506e4"></script>
<script type="text/javascript" src="static/js/bokeh-tables.min.js?v=5f778b8a005d8538b5b13998ec45fc16"></script>
<script type="text/javascript" src="static/js/bokeh-gl.min.js?v=be19384f76795da42f51580e7b5fd473"></script>
<script type="text/javascript" src="C:\path\plotly.js"></script>
<script type="text/javascript" src="C:\path\lodash.js"></script>
Any ideas on how I can achieve completely offline functionality by using local copies of the js?
Thanks!
Dave