title: Apache not able to load stylesheets and scripts in Django's static directory
body: <p>I am developing a site using Django. Up until now, when I have used it in a developement environment it was working fine, loading all stylesheets and scripts normally. However, I have currently shifted over to a production environment using Apache Web Server with mod_wsgi for serving Django pages. Now when I am viewing the site, it is reporting that the css and js files couldn't be loaded and were returned with an error code 403 - Access Denied. My web site is the directory <code>"C:\Users\rohitm\Web Applications\WebApp"</code>. I have installed Apache 2.2 at <code>"C:\Program Files\Apache Software Foundation\Apache2.2"</code>. I have edited the httpd.conf file under the conf sub-directory in the Apache installation folder as follows:</p>
  
  <pre><code>Alias /static/ "C:/Users/rohitm/Web Applications/WebApp/static"
  &lt;Directory "C:/Users/rohitm/Web Applications/WebApp/static"&gt;
  Order allow,deny
  Allow from all
  &lt;/Directory&gt;
  
  Alias /static/images/ "C:/Users/rohitm/Web Applications/WebApp/static/images"
  &lt;Directory "C:/Users/rohitm/Web Applications/WebApp/static/images"&gt;
  Order allow,deny
  Allow from all
  &lt;/Directory&gt;
  
  Alias /static/javascript/ "C:/Users/rohitm/Web Applications/WebApp/static/javascript"
  &lt;Directory "C:/Users/rohitm/Web Applications/WebApp/static/javascript"&gt;
  Order allow,deny
  Allow from all
  &lt;/Directory&gt;
  
  Alias /static/stylesheets/ "C:/Users/rohitm/Web Applications/WebApp/static/stylesheets"
  &lt;Directory "C:/Users/rohitm/Web Applications/WebApp/static/stylesheets"&gt;
  Order allow,deny
  Allow from all
  &lt;/Directory&gt;
  
  Alias /static/admin/ "C:/Users/rohitm/Web Applications/WebApp/static/admin"
  &lt;Directory "C:/Users/rohitm/Web Applications/WebApp/static/admin"&gt;
  Order allow,deny
  Allow from all
  &lt;/Directory&gt;
  
  WSGIScriptAlias / "C:/Users/rohitm/Web Applications/WebApp/apache/django.wsgi"
  &lt;Directory "C:/Users/rohitm/Web Applications/WebApp/apache"&gt;
  Order allow,deny
  Allow from all
  &lt;/Directory&gt;
  </code></pre>
  
  <p>I have created a file django.wsgi in a folder apache under my WebApp folder. The contents are as follows:</p>
  
  <pre><code>import os
  import sys
  sys.path.append('C:/Users/rohitm/Web Applications/')
  sys.path.append('C:/Users/rohitm/Web Applications/WebApp/')
  os.environ['DJANGO_SETTINGS_MODULE'] = 'WebApp.settings'
  
  import django.core.handlers.wsgi
  
  application = django.core.handlers.wsgi.WSGIHandler()
  </code></pre>
  
  <p>The static files settings in settings.py are as follows</p>
  
  <pre><code>STATIC_ROOT = 'C:/Users/rohitm/Web Applications/WebApp/static/'
  
  STATIC_URL = '/static/'
  
  ADMIN_MEDIA_PREFIX = '/static/admin/'
  </code></pre>
  
  <p>After running the <code>manage.py collectstaic</code> command, the static folder has 4 sub folders - <code>admin</code>, <code>images</code>, <code>stylesheets</code> and <code>javascript</code>. The stylesheet folder contains a file <code>main.css</code> while the javascipt folder contains a file <code>jquery.min.js</code>. The admin folder has all the admin related css and js present there. Now whenever I am viewing the site via <code>http://localhost</code>, the css and javascript files are not loaded, while the browser console (Chrome - Crtl+Shift+J) reports that the files failed to load as the server responded with an error 403 (Forbidden).</p>
  
  <p>Please help urgenty.</p>