views:

116

answers:

1

Hello,

I'm trying to run a site with Django on an IIS-based server. I followed all the instructions on the main site (http://code.djangoproject.com/wiki/DjangoOnWindowsWithIISAndSQLServer), and double checked it with a very good article (http://www.messwithsilverlight.com/2009/11/django-on-windows-server-2003-and-iis6/).

I successfully got as far as setting up IIS to read .py files. Following the main instructions, I can get the server to render Info.py. However, I can't seem to get IIS and Django to play nice. If, for instance, my Virtual directory is "abc", then if I go to "localhost/abc/", the browser simply shows me the content directory for that folder. Furthermore, if I have my urls set up so that "/dashboard/1" should bring me to a certain page, entering "localhost/abc/dashboard/1" gives me a "page cannot be displayed" error.

I'm fairly certain IIS simply isn't referencing or interacting with Django at all. Does anyone have any ideas how to fix this?

Thanks

A: 

Serving Django with any webserver basically involves three key details:

  1. Telling the webserver, "I want you to serve content that is provided by this module that invokes python"
  2. Telling the python module, "I want you to execute python code using the details in this file"
  3. Telling the file, "I want you to use Django"

If you're getting a directory listing back for your Virtual Directory then it would seem that you should investigate the VD settings to make sure PyISAPIe is configured for that directory (key details #1).

From the article you mentioned:

  • Open the IIS Management Console, and create a new virtual directory, and allow executing ISAPI extensions when prompted by the wizard.

    • View the properties of the new folder and click on the "configuration" button (if it's greyed out, click 'create' first), then add a new wildcard extension (the lower box), locate the pyisapie.dll file and untick the "check that file exists" box.

    • In the IIS Manager, go to the "Web Service Extensions" section, and right click -> add new web service extension.

  • Give it a name (it doesn't matter what), add the pyisapie.dll fill as a required file and check the box to set the extension status to allowed.

T. Stone