3

Is there a way to deploy Streamlit App on Azure App Service without using Docker? All the guides in the internet refer to Docker virtualization whereas in theory, the Azure Web App should be able deploy the code automatically from Azure Repo. I used “streamlit run app.py” as a startup command in the Azure configuration tab, but nothing really happens.

3 Answers 3

2

You can build this out by setting up a normal Steamlit app and throw in the App Service specific configurations to get this going. Here are the exact steps:

  1. Create Azure App service with pricing tier B1 or higher. Free version(F1) doesnt support websocket which is required for Streamlit.

  2. Create a folder for the project. And add requirements.txt with following content.

    streamlit

  3. Deploy this folder to Azure app service.

  4. Make the following configuration change. Under Configuration > General Settings > Startup command provide the following value

    python -m streamlit hello --server.port 8000 --server.address 0.0.0.0

  5. Enable Web Scockets in the Azure App service configuration.

Azure only allows pip binaries to run when used as modules instead of directly. We are mentioning port beacuse by default the service listens to port 8000. We are mentioning the server.address as 0.0.0.0 so that the it can serve all the incoming request from azure infra.

enter image description here

Sign up to request clarification or add additional context in comments.

3 Comments

with the example works but when I tried to do it with my app unfortunately it does not work. I just changed "hello" through the name of the app. I receive the following error "Cannot read properties of undefined (reading 'portalUrl')"
Can you upload the example deployment somewhere for me to look?
I can not see Enable Web Scockets option. Some people say I must use Windows os, but it is not available for python3. I did choose B1 tier. Streamlit is launching but stuck in Please wait inside Streamlit interface
0

To use this to run your app you need to replace "hello" with "run app.py" (assuming the application name is app.py). For me this worked when I put my code on gitHub and signed in, but I failed both when I deployed via VSCode with Azure extensions, or via gitlab. When I did exactly according to this video it worked: https://www.youtube.com/watch?v=2toRzAYT8yo.

Comments

0

it can be achieved in muliple ways without using Docker

  1. in VS CODE, add extention "Azure App Service". Once you open it, on left hand side navigation , you would see your Resources->your subscription->App Services->your app service name. There you can right click and say "deploy to web app". Select "yes" to allow configuration is the key here Earlier I did not selected yes and so I was getting same error as you sad smily Application error

  2. If your organization allows, during "web app" service creation , under deployment, you can select enable CI/CD option . Then you can authorize with your organization account. It will trigger deployment from github repository

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.