Changes between Version 30 and Version 31 of DjangoOnWindowsWithIISAndSQLServer


Ignore:
Timestamp:
Jan 11, 2008, 6:25:19 PM (17 years ago)
Author:
phillip@…
Comment:

updated slightly to reflect changes to PyISAPIe 1.0.4

Legend:

Unmodified
Added
Removed
Modified
  • DjangoOnWindowsWithIISAndSQLServer

    v30 v31  
    22Getting Django to run on Windows, with pages served by IIS, and a SQL Server backend. Assume Windows Server 2003, IIS 6 and SQL Server 2005 where no versions are specified. You should already have Windows, IIS and SQL installed and working before following this guide.
    33
    4 '''''Note:''' This doesn't work with Django <=0.91 as the IIS extenstion is written to the APIs in Django >=0.92 [SF]''
     4'''Note''': As of PyISAPIe version 1.0.4, this works with Python 2.5. The provided handler works with the current (1-11-08) CVS version of Django.
    55
    6 '''Note2''': This doesn't work with Python 2.5. It must (for some reason) be Python 2.4
     6'''Note2''': PyISAPIe also provides a WSGI adapter that may work with earlier versions of Django. Refer to the new release and docs: http://pyisapie.sourceforge.net/
    77
    88=== Steps ===
     
    2626Now on with the setup: Go to http://pyisapie.sourceforge.net/ and download it (look in the menu on the right, under "Links" for a download link). Unzip the archive so you can copy files out of it.
    2727
    28 I will assume you've extracted it to c:\pyisapie, and are using c:\python24 as the folder where Python is installed, but please change these where necessary for your setup.
     28I will assume you've extracted it to c:\pyisapie, and are using c:\python25 as the folder where Python is installed, but please change these where necessary for your setup.
    2929
    3030There is documentation in the readme files, but at the time of writing the install consists of:
    3131
    3232=== Setting up Files ===
    33  * Copy c:\pyisapie\PyISAPIe.dll to c:\python24\
     33 * Copy c:\pyisapie\PyISAPIe.dll to c:\python25\
    3434 * Edit the properties -> security settings on that file, add "Network Service" and tick "read" permission. (So IIS can use it).
    35  * Go to c:\pyisapie\source\PyISAPIe\Python\ and copy the entire Http folder to c:\python24\lib\site-packages. '''''Note:''' the Http folder is case sensitive.  Saving in 'http' (or any other variation) will not work [SF]''.
     35 * Go to c:\pyisapie\source\PyISAPIe\Python\ and copy the entire Http folder to c:\python25\lib\site-packages. '''''Note:''' the Http folder is case sensitive.  Saving in 'http' (or any other variation) will not work [SF]''.
    3636
    3737=== Setting up IIS ===
     
    5555  * For Executable, browse to pyisapie.dll (needs full path if you enter manually)
    5656  * For extension enter ''*'' (this will redirect all requests to pyisapi)
     57    * ''Using star DOES NOT work in IIS 5, you must specify an extension. [pjs]''
    5758  * ''You should probably limit the verbs allowed; I left as ''all'' since it was for internal use.''
    5859  * Untick the "check that file exists" box.
     
    6364
    6465== Django ==
    65 '''Please note that as of March 7th, 2007, the below instructions will not work for the latest development versions of Django.  In order for PyISAPIe to work with Django (and vice versa), you must be using Django v. 0.95.  Versions 0.95.1 and any higher produce numerous errors that seem to be related to PyISAPIe's stalled development.  Thankfully, you can still download version 0.95 from the Django download site.'''
    66 
    6766'''Text below saved in hope of an update to PyISAPIe:'''[[BR]]
    6867''If you want to keep up with the latest Django development version, you will need to download and install a subversion client for Windows, e.g. [http://tortoisesvn.tigris.org/ Tortoise SVN], install it, then create a new folder somewhere. Right click on the folder, and choose "SVN Checkout". Give the URL of the repository as: http://code.djangoproject.com/svn/django/trunk/  and click OK.)''
    6968
    70 ''Otherwise, just download the latest Django release from the main site, and extract the archive to a folder, e.g. c:\python24\django\.''
     69''Otherwise, just download the latest Django release from the main site, and extract the archive to a folder, e.g. c:\python25\django\.''
    7170
    7271=== Installing Django ===
     
    7473
    7574{{{
    76 c:\> cd python24\django
    77 c:\python24\django> python setup.py install
     75c:\> cd python25\django
     76c:\python25\django> python setup.py install
    7877}}}
    7978
     
    8382c:\> md test
    8483c:\> cd test
    85 c:\test> d:\Python24\django\django\bin\django-admin.py startproject proj
     84c:\test> d:\Python25\django\django\bin\django-admin.py startproject proj
    8685
    8786c:\test> cd proj
     
    9998
    10099=== Linking Django to PyISAPIe ===
     100
    101101Next, 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.
    102102
    103  * 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:
     103 * Put Isapi.py in c:\python25\lib\site-packages\Http folder. According to the example given above, you'll make the following changes to it:
    104104
    105105{{{
     
    112112}}}
    113113
    114  * 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:
    115 
    116 {{{
    117 # ...some stuff ahead
    118 
    119 class PyISAPIeRequest(http.HttpRequest):
    120     def __init__(This):
    121         # ADD THIS LINE!
    122         This.method = Env.REQUEST_METHOD
    123 
    124         # ...and don't need to change the rest
    125 
    126 # some stuff behind...
    127 }}}
    128 
     114 * Put pyisapie.py in c:\python25\lib\site-packages\Django-xyz-123.egg\django\core\handlers folder.
    129115 * It doesn't seem that ''IIS+Python+PyISAPIe'' support multiple Django sites.
     116   * ''This is related to the impossibility of having multiple values for DJANGO_SETTINGS_MODULE in os.environ within a single IIS worker process. Can said value be specified in the request env? [pjs]''
    130117
    131118=== Serving Django with IIS ===
     
    160147== Known Issues ==
    161148 * On IIS 5, you have to use the console command "iisreset" for code changes to take effect. Just restarting the website in ''IIS Management Console'' has no use. How about IIS 6? (20070304/henrik: - same for iis6 on win2k3)
     149   * ''NOT true for IIS6: right-click on the application pool your site is using and select "Recycle." [pjs]''
    162150 * ''I had to create a "media" virtual directory for the stylesheets, etc, at the root of my IIS directory tree (urgh) with read permissions to get the admin site to load styles.  Looking at the source for the admin page in my browser, the stylesheet link is absolute (/media/...) [rnm]''
    163151== Install the PyWin32 Extensions ==
     
    167155Go to the homepage, which is http://adodbapi.sourceforge.net/ then follow the link to download the latest version.
    168156
    169 Then extract the zip file somewhere, e.g. c:\python24\adodbapi, and run 'setup.bat' from that folder.
     157Then extract the zip file somewhere, e.g. c:\python25\adodbapi, and run 'setup.bat' from that folder.
    170158
    171159== Configure Django to look at SQL Server ==
Back to Top