Code

Changes between Version 13 and Version 14 of DjangoOnWindowsWithIISAndSQLServer


Ignore:
Timestamp:
09/23/06 02:20:56 (8 years ago)
Author:
rockallite.wulf@…
Comment:

Some more details on Linking Django to PyISAPIe

Legend:

Unmodified
Added
Removed
Modified
  • DjangoOnWindowsWithIISAndSQLServer

    v13 v14  
    3838 
    3939==== IIS 6 ==== 
    40  * 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 file exists" box. 
     40 * 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. 
    4141 
    4242 * In the IIS Manager, go to the "Web Service Extensions" section, and right click -> add new web service extension. 
     
    5353  * For extension enter ''*'' (this will redirect all requests to pyisapi) 
    5454  * ''You should probably limit the verbs allowed; I left as ''all'' since it was for internal use.'' 
     55  * Untick the "check that file exists" box. 
    5556  * 'OK' to close all the open dialogs. 
    5657   
     
    9293 
    9394=== Linking Django to PyISAPIe === 
    94 Next, you must follow the readme in the PyISAPIe examples\django folder (it explains where to copy two files - one goes into the Django install (One goes into python24\lib\site-packages\django-xyz-123.egg\core\handlers\). Then edit the isapi.py file you just copied to lib\site-packages\Http\. See where it says you should change a line? If applicable, edit it for your django.settings.module settings. 
     95Next, you must follow the readme.txt in the PyISAPIe examples\django folder, basically copy two files into specific folders. Then edit them a bit in order to fit your needs. 
     96 
     97 * Put Isapi.py in c:\python24\lib\site-packages\Http folder. According to the example given above, you'll make the following changes to it: 
     98 
     99{{{ 
     100# Add these two lines, and python will import DJANGO_SETTINGS_MODULE with no problem 
     101import sys 
     102sys.path.append(r'E:\test') 
     103 
     104# Indicate the settings module of your project 
     105os.environ["DJANGO_SETTINGS_MODULE"] = "proj.settings" 
     106}}} 
     107 
     108 * Put pyisapie.py in c:\python24\lib\site-packages\Django-xyz-123.egg\django\core\handlers folder. But there's a bug in PyISAPIe v1.0.3 that prevent it from working (hopefully they'll fix it in the next release). What you have to do is to add a single line of code to the pyisapie.py file you just copied: 
     109 
     110{{{ 
     111# ...some stuff ahead 
     112 
     113class PyISAPIeRequest(http.HttpRequest): 
     114    def __init__(This): 
     115        # ADD THIS LINE! 
     116        This.method = Env.REQUEST_METHOD 
     117 
     118        # ...and don't need to change the rest 
     119 
     120# some stuff behind... 
     121}}} 
    95122 
    96123=== Serving Django with IIS ===