Can't deploy Python (Dash) WebApp to Azure

Hi everyone,

Can anyone explain how to deploy a WebApp built via Dash (Python) to Azure? I a few WebApps that work perfectly fine when deployed locally in development server on my pc.

This is the example of the code I am trying to deploy. Also, I deployed that same code on Render.com and it works.
Dash-by-Plotly/Good_to_Know/resume at master · Coding-with-Adam/Dash-by-Plotly · GitHub

Deployment itself is “successful” in Azure, but WebApp itself is not working. I am getting this error when I am clicking the URL for my WebApp.
Imgur

When I go to the “Diagnose and Solve Problems” section, I see following (see screenshots):

  1. Observations and Solutions (5)
    Imgur: The magic of the Internet
  2. Successful Checks (7)
    Imgur: The magic of the Internet
  3. Failed Loading Checks (3)
    Imgur: The magic of the Internet

There must be some difference in deploying between Render.com and Azure. Maybe I need to add/remove/change some line of code if I want to deploy on Azure?

Note 1: I am using Python 3.10 and VSCode.
Note 2: To deploy the WebApp I am following instructions from this tutorial on Youtube.

Note 3: I can’t do a “Health Check” on Azure because it is not available on “Free” plan.

Let me know if I can provide any more information.

Any recommendations, help is appreciated.

Thanks in advance.

Hello @mrel,

I just looked this up for deploying Flask. You should be able to work with Dash just the same.

I haven’t deployed on Azure. But am intrigued by this. I was thinking about using a vm for control over the different workers initially.

@jinnyzor , yeap, same.
I am intrigued too.
I don’t have enough knowledge and experience to understand, what is the difference between Render.com and Azure.
Why deploying on Render works, but deploying the same thing on Azure doesn’t.

1 Like

I am getting somewhere with deploying:

image

SSH to container:

Logging of app:

Also, check under the deployment center > logs for the git info:

If you watch the log while trying to push requirements.txt this is what you see:

With this, we can see if there are any errors when trying to install.

@jinnyzor , is your URL working after you are deploying this code from “Charming Data”?

I didn’t have problems with deployment. My problem was that after the “successful” deploymeny my app wasn’t working.

Ok.

So, for this to run, gunicorn will not server the Dash app directly.

Therefore, you have to change this setting:

To this:

gunicorn --bind=0.0.0.0 --timeout 600 app:server

And in your code, you have to expose the app’s server, via:

server = app.server

All based on this answer:

1 Like

And mine was a custom code, not Charming Data.

@jinnyzor , I can’t believe it, you did it.
The Startup Command was the missing piece.
gunicorn --bind=0.0.0.0 --timeout 600 app:server

Thank you so much!

2 Likes