Get Microsoft Silverlight

This blog — and all projects contained within — was made with free/demo software available through the Microsoft Web Platform. Go check it out today, it’s pretty cool.

Get the Microsoft Web Platform.

Django Follow-up

It’s been about two week since I launched our first Django-based web site hosted on our IIS box, and I’ve gotten a few AIMs, and emails from folks with an assorted array of questions. Maybe the answers will help others.

### Why would you host on a Windows box instead of Linux?

We host numerous sites for our clients, and write sites using whatever technology fits the bill. Truth be told, for all of the benefits of a normal LAMP stack, if I want to work with the full assortment of web languages, including ASP.NET, a Windows box makes sense. They’re more expensive, yes, but as far as I’ve seen, the performance is on par with, or better than, my normal Linux setups.

So for Mess, it makes sense.

### Did you have to hack the Django core at all to get it working right?

No. Luckily, the guys who wrote Django are fantastically smart, and wrote the core in an OS agnostic way.

I am not that smart, and I did have to make numerous modifications to my own Django-apps to get them running. The biggest issue was file paths. Instead of a using a simple string for paths, I now wrap all file operations with os.path.normalize. I continue to write using Linux style backslashes, since it’s habit at this point, but the paths work on my Mac when I’m developing locally, and on the IIS box when I deploy.

I also had to rip out all of my print statements. PyISAPie echoes any print out to the browser, so the first few tries I had lots of broken HTML, extra returns and debugging messages. I switched everything over to use the built-in logging module, and it worked well enough.

### What’s performance like?

I’d say it’s “fast enough”.

I don’t have comparison benchmarks to give, as I don’t have a Linux box anywhere that’s comparable to the Windows box we’re running these sites on, but I can tell you that load testing has shown that IIS + Django performs just fine.

I do my load testing using siege, and the box consistently rated as being capable of handling 150 requests per second without breaking a sweat. The closest Linux box I have to test it against has half the RAM, and a much slower CPU, and it can generally deal with about 45 requests per second without too much fuss. But that is so not an apples vs. apples comparison.

### Would the setup you mentioned work with IIS7 and/or Windows Server 2008?

I don’t see why not. I’ve only heard of one confirmed installation on that setup, so your milage may vary.

### What about WSGI?

I tried it and could not manage to get it working. At all. It’d crash nearly ever other request, or just fail to start. Occasionally, it’d run great for an hour and then take down the IIS process.

In theory, it’d be absolutely awesome if there was a solid port of mod_wsgi for IIS, so we could deploy a single version of our Django sites to both our internal Linux staging server, and our production Windows machine.

In theory, communism works. In theory.

  1. Email for verification purposes.

    Comments will be deleted if they are inappropriate.