Data Science

Building a Domino Web App with Dash

Randi R. Ludwig2018-01-17 | 4 min read

Return to blog home

Randi R. Ludwig, Data Scientist at Dell EMC and an organizer of Women in Data Science ATX, covers how to build a Domino web app with Dash in this post.

Building a Domino Web App with Dash

Say you’re a data scientist using Domino as your exploration and development platform. You’ve done an analysis that highlights some really useful results! You know your team is going to want to check on this analysis and explore results as new data comes in. This is the perfect case for building an interactive interface for your analysis and results.

Dash is a framework for building interactive web apps, particularly conducive to developing analytical interfaces like dashboards. While R users have Shiny, Pythonistas have Dash. Dash was developed by the team and is built on a Flask framework, so anywhere Flask works, Dash should also work. While providing an interface for interactive graphics, Dash provides support for a host of functionalities. If you’re interested to learn more, the Dash team has provided excellent tutorials. For more examples to see what Dash can do, check out this extensive set of resources.

Getting Dash on Domino

There are a few things you’ll need to get Dash deployed in Domino Data Labs. First things first, you need to install the Dash dependencies in your Python-enabled environment. As of January 2018, the following commands are what you’ll need to add to the Docker file for your Domino environment:

pip install dash==0.19.0  # The core dash backend
pip install dash-renderer==0.11.1  # The dash front-end
pip install dash-html-components==0.8.0  # HTML components
pip install dash-core-components==0.15.2  # Supercharged components
pip install plotly --upgrade  # Latest Plotly graphing library

Check for the latest package versions.

Domino App Framework

All apps deployed on Domino use a common structure. While your app code can be whatever you want, in the same project that you intend to deploy, you need to include an file. For Dash apps, this file is remarkably simple and needs to contain only a single line:

> python

This is the same command you would use to run the app if you were developing locally. (As an aside, developing an app on your local machine to test out many tweaks of the content, interface, etc. and then uploading the file to Domino is a good development strategy to get started.)

Dash Settings for Domino

Once you have an app and you’re ready to deploy on Domino, there are three additional configurations you’ll need in your file compared to what you would have on your local machine. First, you have to provide Domino with the ability to find the Dash dependencies you installed. By default, Dash looks for all of your files in the root folder at “/”. Because Domino uses a reverse proxy and subfolders, you have to tell Domino to look in the current working directory for all of the relevant files and resources. To do this, you need to provide Dash with the configuration it needs:

# Configure path for dependencies. This is required for Domino.
#### as the proxy server may remove the prefix
'routes_pathname_prefix': '',
    #### the front-end will prefix this string to the requests
    #### that are made to the proxy server
    'requests_pathname_prefix': ''

Note: this app.config syntax only applies to dash 0.18.3 and newer.

The next addition is to make the Flask server visible to the Domino web app server by adding the following line:

# This enables the Flask server to be visible to the Domino server
server = app.server

Finally, at the end of your file you need to explicitly include the host and port of the web app server. For all Domino apps, this is the same.

# host & port need to be explicitly defined for Domino
if __name__ == '__main__':
    #app.run_server() # if running locally
    app.run_server(host='',port=8888) # on Domino

With these three changes, your apps should run on Domino and be visible to the wider world! To see this code in context, check out my GitHub. To learn more about deploying Shiny or Flask apps on Domino, check out the docs.

Randi leads a diverse team of data professionals who deliver data-driven decisions for Global Sales Operations within Dell Technologies. She previously led data scientists within Dell Technologies Services who deliver data science solutions using telemetry data to proactively prevent customer issues and resolve them more quickly when they do happen.

Subscribe to the Domino Newsletter

Receive data science tips and tutorials from leading Data Science leaders, right to your inbox.


By submitting this form you agree to receive communications from Domino related to products and services in accordance with Domino's privacy policy and may opt-out at anytime.