简体   繁体   English

如何在单个Flask应用程序中使用Plotly-Dash创建多个Dashoards?

[英]How to Create Multiple Dashoards using Plotly-Dash in Single Flask App?

I now I can integrate Python Dash with Flask , but is it possible to have more than one dashboards within single Flask application? 我现在可以将Python Dash与Flask集成在一起 ,但是在单个Flask应用程序中是否可以有多个仪表板? The reason is that I want to have different dashboards for different User Groups, and I want each dashboard to scale independently from the other. 原因是我想为不同的用户组使用不同的仪表板,并且我希望每个仪表板都可以彼此独立地扩展。

You can just create multiple dash instances. 您可以只创建多个破折号实例。 I'm not exactly sure what you mean with scale independently? 我不确定自己独立使用规模意味着什么吗?

Example

Below is a minimal example of creating 2 dash instances. 以下是创建2个破折号实例的最小示例。 You can just add your figures and callbacks as you're used to. 您可以像往常一样添加数字和回调。

import dash
import dash_html_components as html
from flask import Flask

server = Flask(__name__)

# Set-up endpoint 1
app_1 = dash.Dash(__name__, server=server, url_base_pathname='/app1/')
app_1.layout = html.H1('App 1')

# Set-up endpoint 2
app_2 = dash.Dash(__name__, server=server, url_base_pathname='/app2/')
app_2.layout = html.H1('App 2')

# Run server
server.run()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM