Hi, @Alban Vicarini
- Can you share run-time errors?
- Try deploying the Python Flask app according to the following URL (https://learn.microsoft.com/en-us/azure/developer/python/tutorial-deploy-app-service-on-linux-02?tabs=cmd)
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Actually I have tried to deploy my Python Flask app on Linux Azure App Service but after deployment I am not able to access my app application.
1) I create Linux base Azure App Service on Azure using Azure Portal in which I select python 3.8.
2) I select free basic version for starting and create service.
3) After successfully creation of Azure App Service I go back to my VS code and in VS code I am able to see this new app service.
4) I right click on the newly create app service and click on deploy
5) After deployment when I tried to access my url I got an error even I am not able to see my deployed code when i use KUDU from Azure App Service.
I have checked many urls and follow same steps but still not successfully deploy my Python Flask app on Linux base Azure App Service.
Can any one help me on this please?
Thank you in advance
Hi, @Alban Vicarini
Thank you for your reply.
But can you please tell me what should I do for next steps that is step - 4 -> https://learn.microsoft.com/en-us/azure/developer/python/tutorial-deploy-app-service-on-linux-04
I am not able to understand that what can I do for below point.
You have a Flask app whose main code file is named something other than app.py or application.py*, or the app object is named something other than app.
In other words, unless you have an app.py or application.py in the root folder of your project, and the Flask app object is named app, then you need a custom startup command.
For instance, the main file in the code example from Step 2 is named hello.py and the app object is called myapp, so a custom startup file is necessary as shown in this article.
In my project main file is app.py .
after that what can I put in startup command(Please check screen shot for this) plus where should i run command gunicorn --bind=0.0.0.0 --timeout 600 hello:myapp in my case.
Thank you in advance for your help.
I got below error (Please check the screen shot) when I add gunicorn --bind=0.0.0.0 --workers=4 app:app in general setting of app service.
Thanks for asking question!
In general, The first step in troubleshooting is to use App Service Diagnostics:
In your case it seems there are Application Errors that may have caused the container to crash were detected
Could not find virtual environment directory /home/site/wwwroot/antenv.2022-04-07T06:03:22.842783748Z WARNING: Could not find package directory /home/site/wwwroot/__oryx_packages__.
Recommended Action: The application maybe facing a generic error which is causing your app to fail proper startup. To access your logs go to https://tennisliveapp.scm.azurewebsites.net/api/logs/docker and review them by opening the files with the words
ModuleNotFoundError: No module named 'flask_restful' error
Cause: The application maybe missing a Python package which is causing your app to fail proper startup.
Recommended Action: If you see an error like
ModuleNotFoundError: No module named 'example', this means that Python could not find one or more of your modules when the application started. This most often occurs if you deploy your virtual environment with your code. Virtual environments are not portable, so a virtual environment should not be deployed with your application code. Instead, let Oryx create a virtual environment and install your packages on the web app by creating an app setting,
SCM_DO_BUILD_DURING_DEPLOYMENT, and setting it to
This will force Oryx to install your packages whenever you deploy to App Service. For more information, please see this article on virtual environment portability.
Further Refer this article to deploy your app properly.
Also, you may requires more than 230 seconds to complete initialization and respond successfully to the Platform's HTTP Ping , we allow you to increase that 230 second wait time up to a limit of
1800 seconds. To configure that, add an app setting called
WEBSITES_CONTAINER_START_TIME_LIMIT and set it to the number of seconds you would like for us to wait for your container to start.
Check this link: https://learn.microsoft.com/en-us/archive/blogs/waws/things-you-should-know-web-apps-and-linux#if-your-container-takes-a-long-time-to-start-increase-the-start-time-limit
Let us know if further query or issue remains.
If you found a solution share it please, i got the same issue with the deployment. I have already tried to change the Start time limit and put to 1 SCM_DO_BUILD_DURING_DEPLOYMENT. And i still have the same issue.