How to deploy streamlit on Azure?

Could anyone please tell me the steps to deploy streamlit app on Microsoft Azure

1 Like

Hi @temp_cmd

The steps depends. Do you wan’t the fastest way to get on Azure with a hoppy project or something you can use robustly for your work over a longer period of time?

I’ve deployed awesome-streamlit.org via Azure and I’ve chosen something robust and automated.

  • Azure DevOps Repo
  • Docker (expose your Streamlit App on port 80). Dockerfiles
  • Docker Hub as my container registry. Registry
  • Azure DevOps Pipelines for CI/ CD yaml files, My CI/ CD Setup
  • Azure Web App for containers (configure “Always on” to True). Overview
  • set folderWatchBlacklist = [''] in the config.toml file

This takes some time to setup. When it’s done it’s amazing. When I merge into MASTER everything is automatically built, tested and deployed. And I can replicate everything and debug locally in an identical Docker container.

An easier way would (I think) be with an Azure Web App. But I’ve never tried that. For small hobby projects I’ve used Heroku before with success.

Hi Marc

I have the same problem. The solution is to embed the ping part in your python code?

Sojohan

1 Like

Hi @temp_cmd,
thanks for posting on the forum. I haven’t personally tried on Azure, but @Marc’s answer is excellent. I do deploy Streamlit on Google Cloud routinely and the only caveat I have is making sure that Websocket does not need a special configuration. For the rest it should work fine. I know people have had lot of success deploying on Heroku as well and I have seen several Streamlit apps on Heroku.

Best,
Matteo

Hi @sojohan, thanks for posting. Can you elaborate a little bit more on your specific problem? On top of my head, I don’t think you need anything special with the ping.

Best,
Matteo

1 Like

Hi @sojohan

I’m sorry. But I don’t understand the question. Could you elaborate it?

Marc

Marc’s answer is excellent, thx!

If your deployed Azure web app still hangs on “Connecting…”, like mine was, make sure you have no Cors enabled, not even “*”

1 Like

To add another source of information about Azure:

Richard Peterson over at Towards Data Science just published a how-to on deploying Streamlit to Azure.