Dash#

To deploy a Dash application you need a Ploomber Cloud account and at least two files zipped up:

  1. Your application file (app.py)

  2. A dependencies file (requirements.txt)

Required files#

You can use this template to get started.

In the requirements.txt file, add all the dependencies that you need for your application to run. The application logic should exist in an app.py file and be initialized in this way:

# name your app "app"
app = Dash(__name__)
# add this line below
server = app.server

Note

  • server = app.server - Required to start a production grade server. Without it, deployment will fail as the infrastructure cannot find the server to start.

  • app = Dash(__name__) - The deployment may require modification of the application’s basic routing. If deployment fails, check the following log:

    ERROR: We were not able to modify your Routing automatically

    INSTRUCTION: Please add url_base_pathname="/application/" to app = Dash(__name__, ...)

This modification is automated, but you may see the notice above if it fails.

Testing locally#

To test the Dash application, you can run the following commands locally:

# build the docker image
pip install -r requirements.txt

# Start the dash application
gunicorn app:server run --bind 0.0.0.0:5000

Now, open http://0.0.0.0:5000/ to see your app.

Deploy#

Deploy from the menu

Once you have all your files, create a zip file.

To deploy a Dash app from the deployment menu, select the Dash option and follow the instructions:

Try an example

To download and deploy an example Dash application start by installing Ploomber Cloud and setting your API key:

pip install ploomber-cloud
ploomber-cloud key YOUR-KEY

Tip

If you don’t have an API key yet, follow the instructions here.

Now, download an example. It will prompt you for a location to download the app. To download in the current directory, just press enter.

ploomber-cloud examples dash/clinical-analytics

Note

A full list of Dash example apps is available here.

You should see a confirmation with instructions on deploying your app. Now, navigate to your application:

cd location-you-entered/clinical-analytics

Deploy from the CLI

Initialize and deploy your app with:

ploomber-cloud init
ploomber-cloud deploy --watch

Tip

To ensure your app doesn’t break on re-deployments, pin your dependencies.

Community Edition Banner#

When deploying Dash apps using our Community Edition, we automatically add a marketing banner to your application. This banner helps us maintain and improve our free hosting services. To remove the banner, you’ll need to upgrade to a paid plan.

If you experience any technical issues with your application related to the banner, please don’t hesitate to reach out to our support team for assistance.

Production deployments#

Ploomber has features to help you deploy production-ready Dash apps

Authentication#

Our integration with Auth0 allows you to easily add authentication to any Dash app. There’s no need to modify your Dash app code, only pass your Auth0 configuration parameters. Check out the sample app.

Features#

Ploomber Cloud supports many features to help you build Dash applications quickly!

Troubleshooting#

By default applications run with Python 3.11. Refer to this section for customized deployments. Here is a sample Docker-based Dash application.

Examples#