title: running migrations as a part of an MS Azure app service release pipeline for a Django web app
body: <p>I am wondering if anybody has experience with integrating a <code>python manage.py migrate</code> command into a MS Azure release pipeline. The app is being deployed using CI/CD pipeline through DevOps. In the release pipeline portion, the app is being deployed to three different stages (dev, test and prod). I have not been successful in being able to integrate the migrate command into the deployment process. I have tried achieving this by using a post deployment inline script:</p>
  
  <pre><code>/antenv/bin/python /home/site/wwwroot/manage.py collectstatic
  /antenv/bin/python /home/site/wwwroot/manage.py migrate
  </code></pre>
  
  <p>If I run the above commands in the sandbox environment via SSH they are carried out successfully. 
  However, including them in the release pipeline as a post deployment script raises the following error:</p>
  
  <pre><code>2020-03-22T19:00:32.8641689Z Standard error from script: 
  2020-03-22T19:00:32.8727872Z ##[error]/home/site/VSTS_PostDeployment_1321584903618191/kuduPostDeploymentScript.sh: 1: /home/site/VSTS_PostDeployment_1321584903618191/kuduPostDeploymentScript.sh: /antenv/bin/python: not found
  /home/site/VSTS_PostDeployment_1321584903618191/kuduPostDeploymentScript.sh: 2: /home/site/VSTS_PostDeployment_1321584903618191/kuduPostDeploymentScript.sh: /antenv/bin/python: not found
  
  2020-03-22T19:01:34.3372528Z ##[error]Error: Unable to run the script on Kudu Service. Error: Error: Executed script returned '127' as return code. Error: /home/site/VSTS_PostDeployment_1321584903618191/kuduPostDeploymentScript.sh: 1: /home/site/VSTS_PostDeployment_1321584903618191/kuduPostDeploymentScript.sh: /antenv/bin/python: not found
  /home/site/VSTS_PostDeployment_1321584903618191/kuduPostDeploymentScript.sh: 2: /home/site/VSTS_PostDeployment_1321584903618191/kuduPostDeploymentScript.sh: /antenv/bin/python: not found
  </code></pre>
  
  <p>I also attempted running the above in-line script as:</p>
  
  <pre><code>manage.py collectstatic
  manage.py migrate
  </code></pre>
  
  <p>But to no avail. </p>
  
  <p>Based on the <a href="https://github.com/microsoft/Oryx/blob/master/doc/runtimes/python.md" rel="nofollow noreferrer">Oryx documentation</a>, it seems as though <code>manage.py collectstatic</code> is being run, but not <code>manage.py migrate</code></p>
  
  <p>Any ideas or suggestions would be very much appreciated! Thanks in advance.</p>