Open KathirvelPriya opened 5 months ago
Hi @KathirvelPriya, thanks for your question. Under the hood, Vizro wraps Dash, which itself wraps a Flask app. Hence your question is basically the same as asking how to integrate a Dash app into a web framework.
Dash
should be passed exactly the same into Vizro
, e.g. Dash(routes_pathname_prefix="/dashboard/")
becomes Vizro(routes_pathname_prefix="/dashboard/")
app.server
; in Vizro it's one level deeper in app.dash.server
If you search for how to integrate a Dash app into a web framework then you'll find lots of discussion of it e.g. on the plotly forums. Here's some pointers though:
Here's a very simple working example of Vizro inside an existing Flask app (which, as discussed in this article, might not be the way you actually want to do it, but serves as a good proof of concept).
import flask
import vizro
import vizro.models as vm
server = flask.Flask(__name__)
@server.route("/")
def home():
return "Hello, Flask!"
page = vm.Page(title="My first page", components=[vm.Card(text="Hello, Vizro!")])
dashboard = vm.Dashboard(pages=[page])
app = vizro.Vizro(server=server, routes_pathname_prefix="/dashboard/").build(dashboard)
app.run()
http://127.0.0.1:8050/ gives the Flask app:
http://127.0.0.1:8050/dashboard/ gives the Vizro app:
Hi @antonymilne, Thanks for your reply. I want to integrate with Frappe. I referred plotly-frappe-dash before. But it couldn't help in latest version of frappe.
Ah, that's a pity. I recommend posting on the plotly forums to see if they can help you with that. Basically if you can get it working with pure Dash then you should easily be able to get it working with Vizro. And if you can't get it working with pure Dash then unfortunately you won't be able to get it working with Vizro.
Thank you for your response. I will try.
Question
How to integrate with other applications like flask, frappe or django?
Code/Examples
No response
Other information
No response
Which package?
None
Package version
No response
Python version
No response
OS
No response
Code of Conduct