11# Python to Linux Web App on Azure
22# Build your Python project and deploy it to Azure as a Linux Web App.
3- # Change python version to one thats appropriate for your application.
3+ # Change python version to one that's appropriate for your application.
44# https://docs.microsoft.com/azure/devops/pipelines/languages/python
55
66trigger :
@@ -38,13 +38,10 @@ stages:
3838 displayName : ' Use Python $(pythonVersion)'
3939
4040 - script : |
41- python -m venv antenv
42- source antenv/bin/activate
4341 python -m pip install --upgrade pip
44- pip install setup
4542 pip install -r requirements.txt
4643 workingDirectory: $(projectRoot)
47- displayName: "Install requirements "
44+ displayName: "Install dependencies "
4845
4946 - task : ArchiveFiles@2
5047 displayName : ' Archive files'
@@ -54,6 +51,9 @@ stages:
5451 archiveType : zip
5552 archiveFile : $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
5653 replaceExistingArchive : true
54+ exclude : |
55+ antenv/** # Excludes virtual environment if created earlier
56+ **/__pycache__/** # Excludes Python cache files
5757
5858 - upload : $(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip
5959 displayName : ' Upload package'
@@ -72,15 +72,10 @@ stages:
7272 runOnce :
7373 deploy :
7474 steps :
75-
76- - task : UsePythonVersion@0
77- inputs :
78- versionSpec : ' $(pythonVersion)'
79- displayName : ' Use Python version'
80-
81- - task : AzureWebApp@1
75+ - task : AzureWebApp@2 # Updated to version 2 for Linux Web Apps
8276 displayName : ' Deploy Azure Web App : EOAgriTool'
8377 inputs :
8478 azureSubscription : $(azureServiceConnectionId)
79+ appType : ' webAppLinux'
8580 appName : $(webAppName)
8681 package : $(Pipeline.Workspace)/drop/$(Build.BuildId).zip
0 commit comments