After creating a Azure Web app using Python, you may end-up getting below 500 error at some point of your application development process.This Blog describes how to enable logs for a Python Web APP on Azure.

The page cannot be displayed because an internal server error has occurred.

If you have worked earlier on Azure Web app, General tendency would be to look at LogFiles folder in kudu console but that won't provide you much info about python application issue.

To overcome this, Please follow below set of instructions to receive application logs

  • Navigate to your new azure portal and click on settings in your Web app.
  • Click on Application Settings in Settings Tab
  • Enter Below Key/Value pair under App Settings in Application Settings Tab.
Value : D:\home\site\wwwroot\logs.txt    (Enter your choice of file name here)

Azure App Setting

  • Now you should be able to see logs.txt file in wwwroot folder as mentioned in above step

Python Output Logs

Troubleshoot :

If you still haven't found that logs.txt file, check if file is similar to below link content.

Find more details on using Python in Azure Web Apps at below links :