Trouble deploying flask app

Wilson Becker 1 Reputation point
2020-06-15T20:05:28.39+00:00

Hi there-- I have a fully functional flask app that runs perfectly on local host. I pushed it up to github, and am now trying to deploy it to my az app services. After deployment, I get either a 500 error or the generic 'your app is running' page.

I was looking through the logs and it almost looks like one of my requirements didn't make it to the container, although it's in my requirements.txt

Any help would be VERY much appreciated. Thank you!!!
Wilson

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

1 answer

Sort by: Most helpful
  1. ajkuma 22,401 Reputation points Microsoft Employee
    2020-06-16T16:03:58.47+00:00

    WilsonBecker-5627, Welcome to Microsoft Q&A! Thanks for posting the question.

    Python extensions for App Service on Windows are deprecated in favor of a direct deployment to App Service on Linux. So, kindly ensure you're using App Service for Linux rather than a Windows-based instance.

    For Flask, App Service looks for a file named application.py or app.py and starts Gunicorn as follows:

    # If application.py  
    gunicorn --bind=0.0.0.0 --timeout 600 application:app  
    # If app.py  
    gunicorn --bind=0.0.0.0 --timeout 600 app:app  
    

    If your main app module is contained in a different file, use a different name for the app object, or you want to provide additional arguments to Gunicorn, use a custom startup command.

    Use SSH or the Kudu Console (yoursite}.scm.azurewebsites.net) to connect directly to the App Service and verify that your files exist under site/wwwroot. If your files don't exist, review your deployment process and redeploy the app.

    Python apps must be deployed with all the required pip modules. Kindly checkout this document ‘Configure a Linux Python app for Azure App Service’ for more details on this topic.