Deployment Issues with Python Flask app on Azure Web App

Violet Zeng 30 Reputation points
2023-08-08T05:04:44.6333333+00:00

I want to deploy a python flask app using web app service. I was able to run everything local, but failed in deployment. My computer is windows, but my web app is linux.

I uploaded my app.py, requirments.txt and other necessary files on github. In github Action, Build was successful, but error happens in Deploy-Deploy to Azure Web app.

Github debuggin logs shows the problem happened in POLL URL RESULT:

##[debug]POLL URL RESULT: {"statusCode":202,"statusMessage":"Accepted","headers":{"content-length":"532","connection":"close","content-type":"application/json; charset=utf-8","date":"Tue, 08 Aug 2023 04:48:48 GMT","server":"Kestrel","location":"https://APP_NAME.net:443/api/deployments/latest?deployer=GITHUB_ZIP_DEPLOY&time=2023-08-08_04-48-47Z"},"body":{"id":"temp-dd684cd7","status":0,"status_text":"Receiving changes.","author_email":"N/A","author":"N/A","deployer":"GITHUB_ZIP_DEPLOY","message":"Deploying from pushed zip file","progress":"Fetching changes.","received_time":"2023-08-08T04:48:47.7030485Z","start_time":"2023-08-08T04:48:47.7030485Z","end_time":null,"last_success_end_time":null,"complete":false,"active":false,"is_temp":true,"is_readonly":false,"url":null,"log_url":null,"site_name":"msdocs-python-webapp-quickstart-sgx","build_summary":{"errors":[],"warnings":[]}}}
##[debug]Deployment status: 0 'Receiving changes.'. retry after 5 seconds

Error: Failed to deploy web package to App Service.
100Error: Deployment Failed, Package deployment using ZIP Deploy failed. Refer logs for more details.

Here is my workflow file:

on:
  push:
    branches:
      - main
  workflow_dispatch:
 jobs:
  build:
    runs-on: ubuntu-latest
     steps:
      - uses: actions/checkout@v2
       - name: Set up Python version
        uses: actions/setup-python@v1
        with:
          python-version: '3.8'
       - name: Create and start virtual environment
        run: |
          python -m venv venv
          source venv/bin/activate
            - name: Install dependencies
        run: pip install -r requirements.txt
              
        - name: Upload artifact for deployment jobs
        uses: actions/upload-artifact@v2
        with:
          name: python-app
          path: |
            .
             !venv/
  deploy:
    runs-on: ubuntu-latest
    needs: build
    environment:
      name: 'Production'
      url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}
     steps:
      - name: Download artifact from build job
        uses: actions/download-artifact@v2
        with:
          name: python-app
          path: . 
              
	 - name: 'Deploy to Azure Web App'
        uses: azure/webapps-deploy@v2
        id: deploy-to-webapp
        with:
          app-name: 'APP_NAME'
          slot-name: 'Production'
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_4537AA70DE704873A72C204932A4C217 }}
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} vote

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.