404 - Page Not Found

The page that you are looking for could not be found. I recently switched to a new content management platform so some of the old links no longer work. Below are the search results based on the link that you clicked on.

Django running slow on Windows?

I generally do my development on a dedicated development server running Linux with a fairly good amount of RAM (2GB) and a fast processor (the server does a lot more than just server django :)). Even when I am out of office I SSH to the development server. A few weeks ago I was on a trip where I wasn’t going to have good internet access for a lot of time. So, I decided to setup django on my tablet (Windows) to work locally. Everything was great until I had to access the site.




Finally, after a few seconds the main page showed up. Then I clicked on a link.



Once again the page showed up after a few seconds. I was surprised how slow this was behaving. I booted to Linux and there it was very snappy. Unsatisfied with this performance issue, I did some searching and debugging and finally found out that the ‘localhost’ is what was causing the problem. As soon as I switched to the local IP address (, the server came back to life!

If you are developing on Windows and the server seems to be a little slow then make sure to use ’’ instead of ‘localhost:8000’. If you are curious about the cause then search on google for complete explanation. Apparently this has to do with IPv6 and might a be non-IE issue.

Speeding up django’s development server on Windows

I am very picky about my development environment and I need it to be just right, otherwise the fun part of programming disappears. I have a dedicated Linux server in my office that is sharing and serving the development files. This is a solid server, fast enough that django’s development server refreshes as soon as I save the files, even before I have switched to my browser; and that’s how I like it! 🙂 Lately I have been on the road quite a bit so I have had to run the development environment on my tablet (when in Windows 7; runs excellent in Linux). The tablet has OK specs: 1.4GHz Core Duo with 2GB RAM and a 7200 RPM drive (generally the bottleneck). But for some reason django’s development server seems especially slow at serving the files. The refreshes after changes are OK, not fast, but OK. It is the media that it is very slow at serving (understandably so).

I did a lot of research on my options to speed this up. I am using the standard CPython distribution on Windows. I saw a lot of references to unladden-swallow, but there weren’t a lot of benchmarks to prove the speed gain yet. I realize that this is still under very heavy development, but the one benchmark that I found really excited me so I decided to give it a try. Unfortunately, after hunting for a number of source code packages necessary for compilation and still not succeeding I concluded that it wasn’t worth the time yet 😐 I decided to rule out pypy because of the possibility of compatibility issues, I wanted something that I could plug into the existing system. For some of my projects I am using external libraries, which might not work with pypy.

Anyways, my solution ended up involving Apache. Based on the console output of django’s dev server I had an idea that it was slow at serving multiple files. So I decided to serve the media, which generally is the majority of the files in a given view, using Apache and let django’s server deal only with the views. Microsoft’s IIS is also an option, but I had Apache setup for another project so I decided to use that. Below is a part of my dev_settings.py that makes this change.

import socket
# ...

# System specific dev settings.
if socket.gethostname() == "mystic":
	MEDIA_URL = 'https://thebitguru.com/projectname_media/'

With this new combination and using instead of localhost now my dev environment on Windows is fast enough to keep things interesting.

Thank you, come again


About two months ago a friend insisted that I should seriously think about switching to a Mac. OS X is especially of interest to me because I have been into Linux for a few years now, mostly using it as a learning platform, and, given the Unix core, OS X becomes a very nice alternative. There are several things that have kept me from moving to Linux, including (please read the complete post before adding comments) the hit-or-miss upgrades, missing or little support of some hardware, not so great support for Windows based applications (like I said, read the whole post first :)), and the fact that my main jobs have revolved around Windows development. Mac, on the other hand, overcomes many of these issues (VMWare Fusion looks awesome).

With my recent involvement in web development, starting out with Ruby on Rails and then settling on django, I have realized that I now have many more choices of operating systems than I did before. This is especially true since my editor of choice is vim, which is supported on most of the platforms, and I generally do most of my development on a server running ArchLinux. So, here are my thoughts after two months of honest exploration, even going to the extreme of asking a friend running Hackintosh to lend me his computer (in exchange for the tablet :)).