Azure Web App: ): Application Error - Flask Application

Kevin Zhu 51 Reputation points
2020-09-17T19:21:14.43+00:00

I'm currently facing a problem where my application doesn't load properly.

25560-image.png

I've successfully deployed my flask application - shown in my activity log:
25580-image.png

And my start up command is: (gunicorn --bind=0.0.0.0 --timeout 600 main:app) - flask object is app, file name is main.py

But my webpage still isn't loading, please help :((

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

3 answers

Sort by: Most helpful
  1. Kevin Zhu 51 Reputation points
    2020-09-18T14:29:04.99+00:00

    Hi Ajkuma,

    Thankfully I've resolve this issue, but I'm posting this for the next person who stumbles on this problem.
    The problem I was receiving was "docker container could not be started: zoompic_0_54831544", I believe it was trying to ping to another page which wouldn't allow my page to start.

    In order to resolve this problem I followed this website "https://learn.microsoft.com/en-au/azure/app-service/configure-custom-container?pivots=platform-linux"and found that this command "az webapp config appsettings set --resource-group <resource-group-name> --name <app-name> --settings WEBSITES_PORT=8000" saved my code, and my app is now up and running properly.

    Just want to give a huge shoutout to the MSFT team, because they were very patient and helpful along the way, without them I would've never been able to get this far!

    3 people found this answer helpful.

  2. Akash Niteen Mahale 21 Reputation points
    2022-07-07T11:32:20.273+00:00

    This is one of the most frustrating errors. The App Service starts giving this error once it restarts. I have written a simple app.py and requirements.txt. No Docker containers were used.
    app.py
    from flask import Flask

    app = Flask(name)

    @Muhammad Shoaib .route('/')
    def index():
    return 'Web App with Python Flask!'

    app.run()

    requirements.txt
    Flask==2.0.2

    Followed exact same steps mentioned here:
    https://learn.microsoft.com/en-us/azure/app-service/deploy-run-package
    for bash, passed the right names of RG and app service.

    Still it gives the same error again and again

    2022-07-07T11:27:52.622Z INFO - Starting container for site
    2022-07-07T11:27:52.623Z INFO - docker run -d --expose=8000 --name *********_0_655c5698 -e WEBSITE_SITE_NAME=******-e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=******.azurewebsites.net -e WEBSITE_INSTANCE_ID=7505105c99ac83d562156ed90505e27f8a145a990ef91c6ebaddedad548660d4 -e WEBSITE_USE_DIAGNOSTIC_SERVER=True appsvc/python:3.9_20220315.5
    2022-07-07T11:27:52.626Z INFO - Logging is not enabled for this container.
    Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
    2022-07-07T11:27:56.384Z INFO - Initiating warmup request to container *******_0_655c5698 for site ******
    2022-07-07 11:28:02,298 [MainThread] [DEBUG] : Initializating AppServiceAppLogging
    2022-07-07 11:28:02,301 [Thread-1 ] [DEBUG] : Did not find any previously bound socket
    2022-07-07 11:28:02,302 [MainThread] [DEBUG] : Initialized AppServiceAppLogging

    There is no good documentation supporting this error

    3 people found this answer helpful.

  3. ajkuma 22,401 Reputation points Microsoft Employee
    2020-09-18T14:18:35.627+00:00

    @Kevin Zhu ,

    We want to help you get to the root of this problem.

    Apologies you’re still experience this issue.
    To better assistance on this issue, we need to take a closer look at some of the specifics -the template/repo, your WebApp and other details as I had indicated offline, in this discussion thread – I would greatly appreciate if you could share those information ( only as requested, please do not share any PII information publicly).

    I totally understand this issue can be frustrating, we need your co-operation to remedy this problem.

    So, from discussion, looks like we made good progress, typically “ The Application error” page comes when the container fails on startup.

    If you haven’t enabled docker logs, you can enable that from Azure Portal (App Service logs blade) to fetch more pointers on the error.

    2 people found this answer helpful.