You should note that I do not advise running Microsoft Windows. Or any software that is end-of-life, unless you are able to patch it yourself. And, so, I especially do not advise people to go configure Windows 7 to host Django using mod_wsgi


Configuring Django on a WAMP Host



Getting Apache ready for Django, on a WAMP host machine, can sometimes be problematic. Particularly because setting up mod_wsgi on Windows (in this case Windows 7) isn’t always straight forward. I’ll be using the deprecated Python 2.7 on Windows with WampServer installed.


django on wamp
Why me?!

Install the mod_wsgi Apache module

  1. Download Or download your respective .so compatible file
  2. Change its name to and
  3. Copy it to $DRIVE/Program Files/Apache Software Foundation/Apache22/modules 
  4. Open httpd.conf as Administrator, or equal. Here, you’re going to find a list of lines with “LoadModule” followed by a bunch of other “.so” files. Simply add LoadModule wsgi_module modules/ to that list.
  5. Restart Apache.


django on wamp
Django on WAMP :(


Creating Configuration Files for Django on WAMP


  1. Next you have to point it at Django
  2. In your Django project root folder, create an apache folder
  3. Change into that directory and create a file named django.wsgi
  4. And, finally create a file named apache_mydjango.conf
  5. Go back to apache’s httpd.conf and add the following line at the bottom of the page: Include "$DRIVE:/projects/mysite/apache_django_wsgi.conf"
  6. Now put these lines in django.wsgi:


Populating Configurations for Django on WAMP


import os, sys

os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()


  1. Open apache_djang_wsgi.conf and prepend:


Alias /images/ "D:/projects/mysite/templates/images/"
<Directory "D:/projects/mysite/images>
Order allow,deny
Allow from all

WSGIScriptAlias / "D:/projects/mysite/apache/django.wsgi"

<Directory "D:/projects/mysite/apache">
Allow from all

<VirtualHost *:80>
    DocumentRoot D:/projects/mysite



Finished Setting Up Django on Windows!