Dash as "Other Full-Stack Web Framework"

I’m looking at maybe being on a web project which will involve some biz-to-biz ecommerce and forms along with some potential heavy lifting for clients with analysis and dynamic data visualization. The potential project manager wants to use domain driven design as illustrated in Percival and Gregory’s Architecture Patterns with Python (with no argument from me. He app could be the kernel of a lot of integration.)

He knows Python and wants to stick to it as much as possible, minimizing the need to use JavaScript directly. His first choices for this enterprise project would be Django + Dash & Plotly, + SQLAlchemy. All excellent choices. Having done a little research, it is evident that neither Dash nor SQLAlchemy are the Django way, and when you work with Django the cost for all it’s comprehensiveness, it you are well advised to do things the Django way. I don’t want to use Flask due the near 100% probability this will grow into a homebuilt enterprise scale app.

https://wiki.python.org/moin/WebFrameworks#Other_Full-Stack_Frameworks lists Dash as a full-fledged Python web framework for ML and data science. Can it be used instead of Django/Masonite/Flask to support the meat and potatoes of a B2B web commerce site hybridized with data science?

hi @trent
:wave: Welcome to the community. That’s a great question.

You might benefit from seeing Plotly’s Dash 500 application since it highlights what a Dash app – built using flask under the hood and deployed with a gunicorn web server – can achieve.

Particularly large scale applications, like the app built by Berkley, and smaller scale scientific ones, like this app built by Sintef, are good examples of how Dash can be used instead of Django/Masonite/Flask to support the meat and potatoes of a B2B web commerce site, hybridized with data science. Also the UI/UX and interactivity will be well supported.

There may be more DevOps support and documentation for deploying and authenticating Django and Flask applications. However, one option would be to use the Dash Enterprise platform which handles hosting and authentication, although it is most commonly used for a data science workbench use case and less common for hosting a single applications.

I hope this helps.

1 Like

Hello @trent,

I am working through creating a B2B on the open source side of things, I have a year+ of using Flask under the belt, which Dash is built on top of.

I really like Dash because I was finding myself custom-building a lot of interactions through JavaScript for functionality that Dash already provides. (Really cool charts, interactive tables, etc.) They also have an active community and tons of experience spread out among them all. Dash is also striving to improve things constantly, vs trying to build components yourself.

Dash is also great because it is well documented and there are tons of examples. You can also create html layouts completely from Python side without having to write actual html. But, you can also go in-depth into things like CSS and JavaScript if the first layer wont work for you.

Being built upon Flask also gives you the flexibility of using flask_login, flask redirects, session cookies and custom api endpoints without going beyond the scope of the application.

As far as using SQLAlchemy, I currently use pyodbc for integrating with my database, but SQLAlchemy is a good option that you can tie directly to the Flask app as well.

2 Likes

@trent I tend to say to people that if the app is analytics and viz focused, and where the analytics is being done in python, then it behooves you to seriously consider Dash, especially if your app is ever going to steer towards the more sophisticated realm … and that if you’re looking to build a gmail client (i.e. NOT analytics and viz focused) then you’re likely NOT to use Dash and more likely to consider Django.

Here’s an example:

It’s Lawrence Berkeley Lab’s new (as of December) Materials Project web front end, built with … Plotly Dash. What was the original version built with for the decade previous? Django.

And of course if you don’t want architect everything yourself → Plotly’s Dash Enterprise offering (which is how Plotly pays it’s bills) is leveraged by organizations to facilitate enterprise operational development and deployment. :slight_smile:

2 Likes

@trent And as a “don’t take it from me” … here’s a couple of relevant testimonials:

1 Like

Hi @DaveG,

My potential future boss at a company which deals in a commodity wants to present customers with an interactive front end which might be like what you could find on a financial site. He basically said, “Dash + Plotly has a good rep, but go shopping.” So the prototype site will eventually need to be hooked to available stock, and ideally gets a frontend for the customer or our rep to buy some logistics. It is eventually expected to connect to multiple apps which could span the enterprise, and we want to build as little of the web framework part as we can.

It will be hybrid commerce and analytics site site. We want to give internal and external customers to have the interactive intelligence they need to make good choices. Dash would be a really good choice.

However, Dash is closely tied to the lightweight web framework Flask, so we would have to build more infrastructure than where Django, where we would expect to mostly install and configure our web framework. Plus, all the literature says use Flask to serve a one (dynamic) web page site, use Django for the enterprise. My quick impression of what the Berkely Lab does is that it seems to serve one very impressive, complex, dynamic web page after another without the need to simulate a session in HTTP.

Our application, needs to do commerce so it will need sessions, it will face external customers so it needs to be branded and pretty, and has interactive visualizations (so it needs Dash), and when it becomes mature it is expected to interact with every nook and cranny in the enterprise so it needs an enterprise-grade server side web framework, like Django.

At this point I’m down to HoloViz Panel and Plotly Dash.

For our use case Dash wins or ties on every feature except having an option to use an enterprise-scale Python web framework like Django, or maybe Pyramid, and options to manage state. (A state management utility would cover that gap.). Unfortunately, those are two very important gaps.

The big issue with Panel is it’s lack of maturity, and to a lesser degree lack of commercial support. However, it looks like the Panel project could become quite a worthy competitor to Plotly, especially with its ties to the HoloViz visualization ecosystem.

Comparison

Maturity:

  • Dash: quite mature
  • Panel: newish

Community

  • Dash: large
  • Panel: smaller

Commercial Upgrade

  • Dash: yes
  • Panel: no

Python Visualization (Eco)system

  • Dash: none
  • Panel: HoloViz

Ease of use

  • Dash: easier
  • Panel: higher learning curve

Administration and Configuration Flexibility

  • Dash: less flexible
  • Panel: more flexible
  • Nate: Panel is harder to use partly because it is more flexible.

Python Web Framework

  • Dash: Flask
  • Panel: Tornado, but it is only a little more than trivial to use Django instead.
  • Note: We would prefer to use Django.

Client-Side execution

  • Dash: always
  • Panel: optional

Pseudo-State and Session

  • Dash: Client side execution adds difficulties managing state.
  • Panel: Server side options can be easier, at a performance cost. Since client-side is an option this can be tuned or evolved.
  • Note: We will need state/sessions.

JavaScript Framework

  • Dash: React
  • Panel: Don’t know

Graphic Back End

  • Dash: Plotly to D3.js
  • Panel: Bokeh to ?.js

ORM

  • Dash: SQLAlchemy
  • Panel: Don’t know
  • Not relevant due to architectureThis text will be hidden

@trent Would you be receptive to me just showing you what Dash Enterprise is / does and with whom, and for what? You can then make your own decisions from there.

Developing at-scale enterprise grade analytics applications is a different animal than dashboards. So what do you do when you want to deploy your apps (and have appropriate devops environment for that), integrate with security/authentication frameworks, with CICD pipelines, when you want to scale, when you want to (cache content, store state, persist custom metadata, invoke computationally intensive long-running task queues, generate interactive point-in-time reports and do so on-demand and/or programmatically based on schedules or triggers). You may even (and we’ve seen this) adopt a hybrid architecture. We have customers who leverage python+Dash and then embed such apps into existing web apps/web sites while ensuring credentials and parameterizations and context are passed along (i.e. not just a simple iframe integration).

These and more are the types of things our enterprise customers hit us up with every day.

So then … yes initial part of your decision will be architecture choices … and then after that part of it will be how much you want to build yourself (and - don’t forget - maintain).

My email is dave@plot.ly

Cheers,

dG

Thanks a lot @DavidG. You’ve been helpful.