Deploying Dash to Azure without using Docker

Deploying Dash to Azure without using Docker

This post is the fourth post concerning Dash and the second post about deploying to Azure App Service. My previous Azure post has been popular, and I thought I was doing a disservice to Azure by using a container to deploy a Python application. Let's get started by building our example application which, if you have read the other posts, will look super familiar.

Step 1: Create Dash Virtual Environment

As with any Python project, let's create a virtual environment for our dash app. This tutorial will assume you are working on Ubuntu.

$ cd ~
$ python3 -m venv .venvs/dash

Now let us activate this virtual environment before we continue.

$ source .venvs/dash/bin/activate

Step 2: Setup the project folder

Now let's create a folder and the initial files that we will need.

$ mkdir dash-az && cd .

Now let's make the single file that is necessary to get a basic Dash app up and running.

Special Note

If you are running pip freeze on Ubuntu, your requirements.txt may end up with a package that will cause errors. Please search for pkg-resources==0.0.0 and remove it from your requirements.txt.

Step 4: Build your Dash app

Now I am not going to be original here, and we are going to use the example application found in the Dash tutorial, with some slight modifications to the message.

Open your applicaton.py and add the following. You will notice this looks a tad different than the previous Azure configuration. That is because Azure is looking for a Flask app named app which it automagically wires up to gunicorn. You can read more here.