title: Custom Deployment to Azure Websites
body: <p>I recently started using <a href="http://gulpjs.com/">Gulp.js</a> to package all my CSS and JavaScript into single files, which I then include in my web app. My web app is written in Python (using <strong>Flask</strong>).</p>
  
  <p>I obviously don't want to track the Gulp output CSS and JS files using git (since they're build output files).</p>
  
  <p>I deploy my website to Azure Websites using push to deploy. That is, I simply run <code>git push azure master</code> and Azure automatically figures out that I'm using Python, sets up <code>virtualenv</code>, installs <code>pip</code> dependencies and so on. <a href="http://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-flask-app/">This article describes how to set this up</a>.</p>
  
  <p>This process works great, but now that I've started using Gulp, I want to ensure that the concatenated JavaScript and CSS files are also produced on the server side whenever I deploy the website.</p>
  
  <p>Moreover, in the future, I would like to have Azure run all the tests upon deployment, and only successfully deploy if they all pass.</p>
  
  <p>Sadly, I have yet to find a satisfying solution for this workflow, since I cannot add custom steps to Azure's automatic deployment process.</p>
  
  <p>I have tried writing a custom deployment script using <a href="https://github.com/projectkudu/kudu">Kudu</a> (as suggested by <a href="http://blog.amitapple.com/post/38417491924/azurewebsitecustomdeploymentpart1/">this blog post</a>), but doing so disables all the automatic steps Azure normally does; running <code>azure site deploymentscript --python</code> only generates a very basic Kudu deployment file which doesn't handle reading in the <code>web.config</code> file, setting up <code>virtualenv</code> or installing the dependencies. I found no documentation regarding how to do this myself; I have use the default, automatic Azure deployment script (which gets generated server-side when I push the code, so I cannot access it myself) because otherwise stuff like virtualenv and pip dependencies aren't handled.</p>
  
  <p>Is there any workaround available so that I may customize my deployment script (e.g. to run Gulp) while still correctly deploying Flask?</p>