Unable to access deployed streamlit web application

Nagesh Machara 0 Reputation points
2025-02-24T09:52:23.2033333+00:00

Deal All,

I am trying to deploy ollama (AI Model Python) by using an Azure.zip file that contains all the necessary files like.py,.sh, and requirement.txt. Ran application in local and is working fine. After deployment using Azure web app service, unable to access the url showing an error as ":( Application Error).". Setup the startup commands and Always on as "ON.". please guide me where am doing wrong

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,960 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bhargavi Naragani 5,975 Reputation points Microsoft External Staff Moderator
    2025-02-25T08:29:21.7333333+00:00

    Hi @Nagesh Machara,

    It seems like you’re running into an Application Error after deploying your Streamlit-based Python app on Azure Web App Service. Since it works fine locally, the issue likely lies with the deployment configuration.

    1. As Streamlit apps are normally run by a certain command, ensure your startup command within your Azure Web App settings resembles the following:
      Swap out your_script.py with your actual Python script that runs your Streamlit application from the below command. The --server.port 8000 and --server.address 0.0.0.0 are necessary because Azure Web Apps listen on port 8000 by default and need the application to listen on all IP addresses.
    streamlit run your_script.py --server.port 8000 --server.address 0.0.0.0
    
    1. Go to your Web App-Configuration-General Settings-Startup Command, paste the above command and save.
    2. As you mentioned you've already done Always On is Enabled, but double-check just in case: In the Azure Portal, navigate to your Web App-Configuration-General Settings-Always On-Set to On.
    3. Ensure your .zip deployment contains all necessary files in the right structure, sometimes the app fails if it can’t find the main Python file, so confirm the file paths are correct:
    /app  
    |-- your_script.py  
    |-- requirements.txt  
    |-- any_other_files.sh  
    
    1. Check that your requirements.txt has been processed properly. In the Kudu Console (Advanced Tools) of the Azure Web App, you can run this command manually to install:
    pip install -r requirements.txt
    
    1. If that does not work, the verbose logs usually provide more information: In Azure Portal, navigate to your Web App-Log Stream. Also look at Kudu Console under Advanced Tools-Debug Console-CMD, access the logs directory and view the recent error messages.
    2. Sometimes, Streamlit will use port 8501 by default. Azure Web Apps require your app to be listening on port 8000, so ensure that your --server.port parameter is specified in the startup command (as indicated above).

    Refer to the below documents:
    Deploy a Python app to Azure App Service
    Configure Python apps on Azure App Service
    Kudu Console for Azure App Service

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.