Django on Azure not loading static files Django on Azure not loading static files django django

Django on Azure not loading static files


I had this problem and none of the suggested answers seemed to fit. My bizarre solution was to switch off Python on the Azure web site configure page.

I arrived at this odd conclusion by installing the PTVS Django sample and following the steps in this tutorial http://azure.microsoft.com/en-us/documentation/articles/web-sites-python-ptvs-django-sql/. The only difference I could fine between my site and the working tutorial was that Django was off! If someone has an explanation I would love to hear it (PHP is enabled!!!).


I found my solution on this page: http://mrtn.me/blog/2012/06/27/running-django-under-windows-with-iis-using-fcgi/

I had to create a central static folder and add a web.config for iis to serve the files. web.config below:

<?xml version="1.0" encoding="UTF-8"?><configuration>  <system.webServer>    <!-- this configuration overrides the FastCGI handler to let IIS serve the static files -->    <handlers>    <clear/>      <add name="StaticFile" path="*" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />    </handlers>  </system.webServer></configuration>

Hope this helps someone!


I don't have enough rep to vote up but the answer does in fact work on Azure for me as well, and appears to be, so far, the only method of doing it. Just remember that the web.config needs to be in the right place...lol...I apparently had multiple static folders as I was trying different ways of solving this.