Making Django development server faster at serving static media

Consider using mod_wsgi instead, and having httpd handle the static media.


Development server is simple unsafe single-threaded application, so you cannot do much.

One trick you could try is to redirect /site_media to second development server, but this is ugly and probably wouldn't help that much. So you could try bundling/compressing multiple assets into one css/js (e.g. using YUI Compressor).

And in any case, you should have separate static media server, that can serve multiple assets at once.


Install Firefox (if you haven't already), and install the Firebug Add-On. Restart your browser. In the lower-right corner click the "bug" icon and make sure that in the "Network" tab (it's a dropdown) of the Firebug panel that opens at the bottom of the browser, the network monitor is active.

Now with the network tab of Firebug open, open your Django-generated page that you observed to load slowly. Take a look at the timeline bars. You'll notice that the colored fragment(s) of each bar indicate(s) the reason for each request's total "load" time. Violet, for instance, means that actually the browser is waiting for the server to generate the response. Gray means it's receiving content. And so on. Hovering over the bars will display a color legend.

With Firebug's network monitor you should be able to pinpoint how exactly your browser and/or server are spending their 10 seconds.

Tags:

Python

Django