Saving Dash layout to html

孤者浪人 提交于 2019-12-01 01:54:52

This solution is not fully working:

You have to save your Webpage complete.
To prevent the javascript creating any errors i have removed the bundle(2).js file.

This file contains the function dash_renderer which tries to interact with the server and creates issues.

<footer>
<script id="_dash-config" type="application/json">{"url_base_pathname": "/", "requests_pathname_prefix": "/"}</script>
<script src="./Dash_files/react.min.js"></script>
<script src="./Dash_files/react-dom.min.js"></script>
<script src="./Dash_files/bundle.js"></script>
<script src="./Dash_files/plotly-1.38.0.min.js"></script>
<script src="./Dash_files/bundle(1).js"></script>
<!-- <script src="./Dash_files/bundle(2).js"> --></script>
</footer>

The result is the same page as you can see for ~1s.

Big disadvantage: The interactivity from plotly is lost.

A Dash app layout is serialized as JSON and served to the front-end by the Dash server (an extension of a Flask server). All Dash components included in your layout are bundled as JS/CSS files. These bundles are also served by the Dash server to the front-end.

Without the server, there is no one to send JSON, JS, CSS bundles to the front-end, so nothing will be rendered.

I'm not sure why you can see your app for a brief moment. My guess is that Dash saves a PNG image of your app every time you run it. Think of it like a splash screen you see before the real, reactive app shows up.

Have a look at this high-level overview on how Dash works under the hood.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!