tags:

views:

1684

answers:

7

I say properly because everyone I have spoken to in the past said running Django on IIS was a hack. I had it working somewhat but it never did quite right and did feel like a hack. I like python but had to give it up because I could never make Django work with IIS and Django was my excuse to use Python in production web apps. But it was so messy that I could not in good conscience sell it to the group. So, I figured why fight it, just stick to asp.net, IIS, roll your own or use frameworks from MS. Just wondering if anything had changed. BTW, not knocking asp.net. I just wanted to use Python.

Thank you.

EDIT - Are there any new plans to officially support IIS yet?

A: 

You should be able to use the FastCGI isapi developed by MS. It works on 6 but has better integration on 7. Disclaimer: I haven't tried it with Django.

Sam Corder
+3  A: 

Django is WSGI-based framework so as soon as IIS get proper WSGI handling there should be no problem in running Django under this environment. Anything that connects WSGI and IIS will do.

Quick googling reveals some project on Google Code.

zgoda
A: 

"official" support is usually not provided for anything but products and languages created by Microsoft.

I mean like an official port by the django team. From all I read it is made only or mainly for apache. thanks.
johnny
A: 

As for the "official" bit... Since Django 1.0 (and newer) are all-WSGI compliant, it will not surprise me if the WSGI at some time will become the only "official" deployment method. Since mod_python is deprecated (and not developed anymore) and FastCGI is really served by FCGI-to-WSGI gateway, this seems reasonable prediction.

zgoda
not to mention that mod_python is a royal pain in the posterior - I have to bounce mod_python apps about 10x more often than mod_wsgi/mod_uwsgi apps.
Redbeard 0x0A
+1  A: 

I was fishing around for some info on the same topic. I found a project on codeplex that Jeff Hardy had implemented the WSGI interface on .net - NWSGI. He also has some entries on his blogs on specifically running DJANGO and IronPython.

Blogs: http://jdhardy.blogspot.com/search/label/Django

NWSGI Project: http://nwsgi.codeplex.com/

thanks. I'm really hoping they make it for iis one day. If not I'll eventually have to use apache.
johnny
+1  A: 

There is another (faster) alternative for direct integration with IIS via WSGI: PyISAPIe.

isapi-wsgi is based from the relatively outdated ISAPI module included with Python and doesn't mesh well with the design of IIS6/7. FastCGI is out-of-process and requires an IPC connection to IIS. Basic CGI means reloading Python for every request.

Also, PyISAPIe has a lower-level interface for those who prefer performance over compatibility.

Phillip Sitbon
Forgot to mention: I've tried selling this and a PyISAPIe-specific handler to the Django devs, but they really don't care about or use Windows/IIS enough for it to be a priority.
Phillip Sitbon
A: 

I know this isn't the answer you're looking for, but hopefully it can help someone else!

I've posted a Django on Windows 2008 tutorial/howto on my blog which you may find helpful.

After a few hours of trying to get Django running on IIS7 using PyISAPIe, I gave up, since I was getting this (difficult to diagnose) error code when visiting the site's URL:

PyISAPIe
0x8007007e

Apparently, this also happens with the PHP ISAP (which apparently indicates a missing DLL dependency), so it could be the same problem as I'm having with PyISAPIe. Also, when I tried to install using the installer, I got some error about a missing DLL so it sounds logical.

Anyway, suffice to say, it looks like Django+IIS isn't that popular, so the support doesn't appear to be excellent...

The server has an additional IP address, so now I'm just going to run Apache along side IIS7, since there are some .Net apps running on the server.

Side note: To run IIS7 and Apache at the same time, you'll need to tell IIS7 to only bind to one IP address.

Update: Just got Django working on Windows Server 2008! It's running on Apache along side an existing IIS7 install (which is bound to only one IP), and seems to work just fine... And, I'd recommend this route, rather than trying to get IIS7 to play nice with Django - trust me, you'll have a better time of it.

nbolton
In the end I decided not to use Django or Rails (maybe jRuby in the future.) I found that Django/Python was hard to use with legacy (old) databases and that Rails convention over configuration was constraining unless I was willing to create all databases from scratch - something I cannot do - and yes I know you don't have to, but it made me feel as if I needed to to take advantage of rails. At the moment I am leaning towards codeigniter - lightweight, can do what I want. Thanks for you answer. I may go back to it.
johnny