How do I deploy a Python executable file to an App Service?

Ajith Thangarasu 0 Reputation points
2024-09-10T08:13:43.01+00:00
  1. I have a Python Flask application, and I built it using PyInstaller, which generated an .exe file and an internal package folder.
  2. I have an Azure App Service (Windows). I deployed the .exe file and internal packages to the /site/wwwroot directory in the App Service and was able to run it on port 8000. However, I'm unable to access the application via the default domain of the App Service.

Could someone please assist or guide me on how to deploy this built .exe file and make the application accessible via the default domain of the App Service?

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

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 16,586 Reputation points Microsoft Employee
    2024-09-30T00:45:10.5066667+00:00

    @Ajith Thangarasu Deploying a Python executable file to Azure App Service and making it accessible via the default domain involves a few additional steps.

    1. Ensure the App Service is Configured Correctly:
      • Make sure your App Service is set to use the correct startup command. For a Python executable, you might need to set the startup command to run your .exe file. You can do this in the Azure portal under Configuration > General settings > Startup Command. Set it to something like:
             ./your_executable_file.exe
        
    2. Configure the Web Server:
      • Azure App Service uses IIS (Internet Information Services) to serve web applications. You need to configure IIS to forward requests to your application running on port 8000. This can be done by creating a web.config file in the /site/wwwroot directory with the following content:
             <configuration>
        
    3. Deploy the web.config File:
      • Ensure that the web.config file is deployed to the /site/wwwroot directory along with your executable and internal package folder.
    4. Restart the App Service:
      • After making these changes, restart your App Service from the Azure portal to apply the new configuration.
    5. Check Application Logs:
      • If the application is still not accessible, check the application logs for any errors. You can view the logs in the Azure portal under Monitoring > Log stream.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.