Description

Django FastCGI cannot be used on Windows, and possibly other non-Unix environments.

Currently the FastCGI feature of Django (manage.py runfcgi) relies on the Python library 'flup', which relies on Unix-only socket functions (socket.socketpair(), socket.fromfd(), etc.) making it impossible to use the FastCGI feature of Django on non-Unix envs like Windows, and hence, making it impossible to serve Django with non-Apache (non-mod_python) httpds like lighttpd on non-Unix envs.

Unix environments, especially GNU/Linux, is of course better than Windows to be used as a web server, but there are some situations where Windows and FastCGI have to be used. It would be good to have Django FastCGI available on Windows.

I can confirm that flup works on Windows and Apache, just not the way most people expect (due to principal differences between files and sockets on Windows). To make it work, you need to start your server like this in your dispatch.fcgi:

Of course with this setup apache won't start your fastcgi server for you (and frankly, with the way python (or flup, I'm not sure) handles signals on Windows you DON'T want apache to start python servers for you, as it won't be able to kill them afterwards), you'll need to do it yourself separately. I, for example, run my fastcgi server as a Windows service (using win32service), which is even better since with this setup apache and fastcgi servers can run as different users.