Changes between Version 10 and Version 11 of DjangoOnWindowsWithIISAndSQLServer


Ignore:
Timestamp:
09/21/2006 07:46:21 AM (8 years ago)
Author:
sfb
Comment:

More tweaking

Legend:

Unmodified
Added
Removed
Modified
  • DjangoOnWindowsWithIISAndSQLServer

    v10 v11  
    11== Goals ==
    2 
    3 Getting 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 mentioned.
    4 
    5 Useful for people who already have such a setup and can't justify (or just don't want) Apache and PostgreSQL as well.
     2Getting 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.
    63
    74'''''Note:''' This doesn't appear to work with Django 0.91 (the pyisapie.py handler is written to the refactored APIs in 0.92 and later) [SF]''
    85
    9 Credit to: http://thinkhole.org/wp/2006/04/03/django-on-windows-howto/ for the Django on Windows with Postgres/Apache guide, from which I took some parts of the django-on-windows setup.
    10 
    11 === Requirements ===
    12  * Windows Server
    13  * IIS installed and working serving normal pages
    14  * SQL Server installed and working
    15 
    166=== Steps ===
    177 * Install Python
    18  * Install PyISAPIe - an extension for IIS
     8 * Install PyISAPIe - an extension for IIS to connect Python with IIS
    199 * Install Django
    20  * Connect up Django and IIS
     10 * Connect up Django with PyISAPIe
    2111 * Configure Django to look at SQL Server
    2212 * Test
     
    2414
    2515== Install Python ==
    26 A simple download and install for this bit, so open http://www.python.org/ and look for "Quick Links" -> "Windows Installer" in the menu on the left. Download and run it, following the wizard steps until it is complete. Easy bit over with, let's get Python talking to IIS.
     16A simple download and install for this bit, so open http://www.python.org/ and look for "Quick Links" -> "Windows Installer" in the menu on the left. Download and run it, following the wizard steps until it is complete.
    2717
    2818== Install PyISAPIe - an ISAPI extension for IIS ==
    2919There is no installer for this, so there are quite a few steps, but they aren't very complicated.
    3020
    31 This is an IIS extension that loads the Python interpreter into memory while IIS is running, and uses it to serve requests more quickly. It avoids the overhead that CGI has of starting Python for every request, however it does mean that some files are cached in memory and you wont see changes while testing your Django site until you restart the process. With IIS 6 you have to right-click on the application pool running your services and select 'recycle' for changes to take. Previous versions of IIS might the whole IIS service to be restarted.
     21Breifly, this is an IIS extension that loads the Python interpreter into memory while IIS is running, and uses it to serve page requests - it avoids the CGI overhead of restarting Python for every request. It does mean that some Django files will be cached and you wont see changes while testing your Django site until you restart the Python process. With IIS 6 you have to right-click on the application pool running your services and select 'recycle' for changes to take. Previous versions of IIS might need the whole IIS service to be restarted.
    3222
    33 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.
     23Now 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.
    3424
    3525I 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.
     
    3828
    3929=== Setting up Files ===
    40  * Copy PyISAPIe.dll to c:\python24\
     30 * Copy c:\pyisapie\PyISAPIe.dll to c:\python24\
    4131 * Edit the properties -> security settings on that file, add "Network Service" and tick "read" permission. (So IIS can use it).
    4232 * 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]''.
    4333
    4434=== Setting up IIS ===
    45 You don't have to create a virtual directory - you can do this with the root folder. If you do use a virtual directory, say /myfolder, then only urls starting with /myfolder will be handled by PyISAPIe. If you use the root folder, all URLs will be handled by PyISAPIe, and you risk everything else on the site being inaccessible afterwards if you're not careful.
     35You don't have to create a virtual directory - you can do this with the root folder. If you do use a virtual directory, say /myfolder, then only urls starting with /myfolder will be handled by PyISAPIe. If you use the root folder, all URLs will be handled by PyISAPIe, and you risk anything else on the site being inaccessible afterwards if you're not careful.
    4636
    4737 * Open the IIS Management Console, and create a new virtual directory, and allow executing ISAPI extensions when prompted by the wizard.
     
    6757That's it installed. In c:\pyisapie\source\PyISAPIe\Python\examples folder is a file called Info.py. Copy this to your new virtual directory folder, and then try and view http://site/Info.py to test it. It should work. If it doesn't, when you find out why, please come back and explain what happened and how you fixed it. ;)
    6858
    69 The PyISAPIe extension has a driver for Django as well, so that's where I will be heading, after this:
    70 
    71 == Installing Django ==
     59== Django ==
    7260I'm not going to say what this is; if you're here, following this, then you should really know by now!
    7361
    74 === Get the development version if you wish ===
     62If 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.)
    7563
    76 If you want to keep up with the latest Django developments, 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 it, and choose to SVN Checkout. Give the URL of the repository as: http://code.djangoproject.com/svn/django/trunk/  and click OK.)
     64Otherwise, just download the latest Django release from the main site, and extract the archive to a folder, e.g. c:\python24\django\.
    7765
    78 === Or get the normal version ===
    79 Otherwise, just download Django from the main site, and extract the archive to a folder.
    80 
    81 === Do The Install ===
    82 Drop to a command prompt (start -> run -> cmd -> OK), change to your Python folder and install Django. Example:
     66=== Installing Django ===
     67Drop to a command prompt (start -> run -> "cmd" -> OK), change to your Python folder and install Django. Example:
    8368{{{
    8469c:\> cd python24\django
     
    8671}}}
    8772
    88 NB: You will probably need to do some messing around with paths and such to make this work neatly. I'm afraid I'm leaving that to you for now. Without doing that you can still test the Django install, but will need a full path to django-admin.py:
     73NB: You will probably need to do some messing around with paths and such to make this work neatly. I'm afraid I'm leaving that to you for now, because I don't have clear steps. If you know any, please put them here. Without doing that you can still test the Django install, but will need a full path to django-admin.py:
    8974
    9075{{{
     
    122107== Configure Django to look at SQL Server ==
    123108With any luck, the suggestion that there is an ado_mssql backend will do, and this will be easy.
     109
     110== Credits ==
     111 * http://thinkhole.org/wp/2006/04/03/django-on-windows-howto/ for the Django on Windows with Postgres/Apache guide, from which I took some parts of the django-on-windows setup.
Back to Top