Local HTML file won't load properly into Dash application

Viewed 1538

I've tried to embed a local html file into a basic Dash App. I used the code in this link and replaced the path with my local relative path (the dash app is in the same folder as the html local page)

html.Iframe(src="random_example.html",
            style={"height": "1067px", "width": "100%"})

but this is the result I get: html.H1 repeats in one another

1 Answers

You could put the html file in the assets folder and reference it like this:

import dash
import dash_html_components as html

app = dash.Dash(__name__)

app.layout = html.Div(
    children=[
        html.Iframe(
            src="assets/random_example.html",
            style={"height": "1067px", "width": "100%"},
        )
    ]
)

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