Thomas Sere
Thomas Sere

Reputation: 125

Local HTML file won't load properly into Dash application

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

Upvotes: 3

Views: 5098

Answers (1)

bas
bas

Reputation: 15722

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)

Upvotes: 7

Related Questions