Dash App export to html

Hi,

I have generated a dash app in localhost, and it runs well. I want to send the result to others, is there anyway to export the current server page as offline html? Thanks.

Hi @RajonDawn welcome to the forums.

What results are you referring to?

Hi, AIMPED

Code below is a app, and I want to save the whole webpage into a html file, so that i could send it to others directly, rather than send the code and need re-run by themselves. Thanks.

import dash
from dash import html, clientside_callback, Input, Output
import dash_bootstrap_components as dbc
import plotly.express as px
from dash import dcc

app = dash.Dash(
    __name__,
    external_stylesheets=[dbc.themes.BOOTSTRAP],
    external_scripts=[
        {'src': 'https://cdn.jsdelivr.net/npm/dom-to-image@2.6.0/dist/dom-to-image.min.js'}
    ]
)

app.layout = html.Div(
    [
        html.H1('Title of the page'),
        html.P('The outside of the card is not saved.'),
        dbc.Button(
            'Download as image',
            id='download-image'
        ),
        dbc.Card(
            'Everything in here is downloaded as an image',
            body=True,
            id='component-to-save'
        ),
        dbc.Tabs(
          id = 'tabs',
          children=
          [
            dbc.Tab(
              dcc.Graph(
                id='scatterPlot', 
                figure=px.scatter([1,2,3], [33,4,5])
              ), label='Tab-1'
            ),
            dbc.Tab(
              dcc.Graph(
                id='linePlot', 
                figure=px.line([1,2,3], [33,4,5])
              ), label='Tab-2'
            ),
          ]
          
        )
        

        
    ]
)


if __name__ == "__main__":
    app.run_server(debug=True)

It’s not possible to create an interactive html from a dash app.

Do you want to share the app with colleagues connected to your company network?

Hi, AIMPED. Thanks for your comments. Yes, I need to share it to my colleagues, but also maybe customer or someone outside our network.

en… I have install a extension named “Web Archive” that can download the dash app webpage, but the filetype is ‘wacz’ and it can only be open by its own extension.
So I want to know does this download step can achieve through JS or other language? Thanks.

If your computer is visible for your colleagues you could just share the link to your app. If you are running your app locally for example like this:

if __name__ == "__main__":
    app.run(debug=True, host= '0.0.0.0', port=8080)

You’ll see the following message in your terminal:
Dash is running on http://0.0.0.0:8080/

The only thing you have to do to share the app within your network, is changing 0.0.0.0 to your IP address, for example 192.168.1.18.

Your colleagues should be able to access your app via http://192.168.1.18:8080/

I don’t know.