This process is not exactly trivial but it is possible using the following steps:
First, download and install Python 2.6. (The reason I suggest Python 2.6 instead of Python 2.7 is because the latest Python version supported by the PyISAPIe module is Python 2.6.) Make a note of the location you install Python to (
C:\Python26 by default if I remember correctly).
Right-click Computer and click Properties. Click Advanced System Settings on the left.
Click the advanced tab and then click the Environment Variables button. Locate Path in the lower list box:
Click the "Edit..." button and go to the end Variable Value and insert
;C:\Python26 (a semicolon plus the path you installed Python to):
Click OK to dismiss all of the dialogs.
Next, download the latest version of PyISAPIe here. Extract the contents of the archive somewhere and open up the directory.
Next, open the Control Panel, click Programs and Features, and click "Turn Windows features on or off" on the left.
Browse to Internet Information Services -> World Wide Web Services -> Application Development Features and then make sure ISAPI Extensions is checked.
Apply the changes and then open up IIS Manager. Double-click the Handler Mappings icon.
Click Add Module Mapping on the right. In the dialog that appears, enter the following information:
- Request path: *
- Module: IsapiModule
- Executable (optional): [Browse to the path where you extracted PyISAPIe and select
- Name: Python via PyISAPIe
It should look something like this:
Before closing the dialog, click Request Restrictions, uncheck "Invoke handler only if request is mapped to:", and click OK. Also click OK to close the Add Module Mapping dialog (click Yes if you are asked whether you want to add the extension with an Allowed entry to the ISAPI and CGI Restrictions list).
The next step is to download Django. Extract the contents of the archive somewhere (noting the location). Open a Command Prompt (you can do this by pressing Win + R, typing
cmd and hitting Enter) and type
cd followed by the location you extracted Django to:
Press Enter, type
cd dj, and then push Tab. This should complete the path to the Django folder and you can press Enter to open the directory. Now type
python setup.py install:
Now you need to create the Django project. For example purposes, we will create the projects under
C:\Django. In the command window, type the commands below followed by Enter:
python C:\Python26\Lib\site-packages\django\bin\django-admin.py startproject test
This creates a project named 'test'.
Once the process completes successfully, the last remaining task is to connect PyISAPIe to Django. To do this, return to the directory you extracted PyISAPIe to and look for an Http directory. Inside is a file
Isapi.py. Open it in a text editor and replace the contents with the following:
from django.core.handlers.wsgi import WSGIHandler as DjangoHandler
from Http.WSGI import RunWSGI
from Http import Env
import os, sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'test.settings'
PathInfo = Env.PATH_INFO
if not PathInfo.startswith('/'):
for Excl in ['/media']:
return RunWSGI(DjangoHandler(), Base='/')
Copy the Http directory to
C:\Python26\Lib\site-packages (or the appropriate directory if you installed Python somewhere else).
Restart IIS (you can do this by clicking "restart" in the right hand side of IIS Manager):
If everything worked correctly, you should be able to go to http://localhost to view your new Django site: