question

WilsonBecker-5627 avatar image
0 Votes"
WilsonBecker-5627 asked ·

Trouble deploying flask app

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-webappsazure-webapps-content-deployment
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

ajkuma-MSFT avatar image
0 Votes"
ajkuma-MSFT answered ·

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.


· 1 · Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Just checking in to see if the above post helped answer your question or you need further assistance, we would be more than happy to assist you.

0 Votes 0 ·