I was profiling the performance of my web application using Google’s Page Speed plugin for Firebug and one of the things it says is that I should ‘leverage caching’ — “The following cacheable resources have a short freshness lifetime. Specify an expiration at least one week in the future for the following resources”. When I dug deeper I found that all request for static files to the Django WSGI server lacked the Expires and the Cache-Control headers. Who should add these headers — should Django do it? If so, how?
Thanks.
Any static files you may have for your page should be served by your web server, e.g. Apache. Django should never be involved unless you have to prevent access of some files to certain people.
Here, I found an example of how to do it: