How to deploy web app (Python/Django/Linux) via zip

  1. Create resource group (Only run it one time)
    az group create –name “JACKY-RG-TEST” –location “westus”

  2. Create App Service Plan (Only run it one time)
    az appservice plan create –name “jacky-test” –resource-group “JACKY-RG-TEST” –sku S1 –is-linux

  3. Create Web app (Only run it one time)
    az webapp create –resource-group “JACKY-RG-TEST” –plan “jacky-test” –name “jacky-jacky2” –runtime “PYTHON|3.6”

  4. Set application settings SCM_DO_BUILD_DURING_DEPLOYMENT=true
    az webapp config appsettings set -g “JACKY-RG-TEST” -n “jacky-test” –settings SCM_DO_BUILD_DURING_DEPLOYMENT=true

  5. Deploy a ZIP file to the webapp
    az webapp deployment source config-zip –resource-group “JACKY-RG-TEST” –name “jacky-jacky2” –src “C:\temp\application.zip”

  6. Modfiy codes and redeploy a zip to the same webapp
    az webapp deployment source config-zip –resource-group “JACKY-RG-TEST” –name “jacky-jacky2” –src “C:\temp\applicationv2.zip”

  7. Create staging slot
    az webapp deployment slot create –name “jacky-jacky2” –resource-group “JACKY-RG-TEST” –slot “staging” –configuration-source “jacky-jacky2”

  8. Modify codes and deploy it to “staging” slot
    az webapp deployment source config-zip –resource-group “JACKY-RG-TEST” –name “jacky-jacky2” –slot “staging” –src “C:\temp\applicationv3.zip”

  9. After testing. Swap staging to production
    az webapp deployment slot swap -g “JACKY-RG-TEST” -n “jacky-jacky2” –slot staging –target-slot production

You can integrate those commands into your CD tools.

HTH. 2020-June-28 by Jacky