Tho*_*ere 3 html css python path plotly-dash
我尝试将本地 html 文件嵌入到基本的 Dash 应用程序中。我使用了此链接中的代码,并将路径替换为我的本地相对路径(破折号应用程序与 html 本地页面位于同一文件夹中)
html.Iframe(src="random_example.html",
style={"height": "1067px", "width": "100%"})
Run Code Online (Sandbox Code Playgroud)
您可以将 html 文件放入assets文件夹中并像这样引用它:
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)
Run Code Online (Sandbox Code Playgroud)