Python – Save the Dash layout to html

Save the Dash layout to html… here is a solution to the problem.

Save the Dash layout to html

I drew a bunch of things in the dash layout. I want to save them to an html file to view later. When I reopened the saved html file, I saw everything correctly at first. However, within <1 seconds, the page becomes blank and I get the error message: “Error loading layout”. (See gif below).

How to solve this problem?

enter image description here


This solution is not fully working:

You must save your web page in its entirety.
To prevent any errors in JavaScript creation
I have removed the bundle(2).js file.

This file contains a function dash_renderer that tries to interact with the server and creates problems.

<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>

The result is the same page you see in ~1 second.

The biggest drawback: Plotly’s interactivity is lost.

Related Problems and Solutions