Generate Static html cache files automatically in django (superjared.com)
Have a django site you want to be able to weather just about anything? Superjared put together a simple way to tweak your django site to auto generate static html pages on database updates which, when combined with nginx configurations, defaults to these html pages. Cool stuff, and a great way to maximize your server's potential with little effort.
10 comments
[ 7.9 ms ] story [ 50.2 ms ] threadI seriously hate gloating, but Rails' page caching has been around for two years. I must be mistaken.
edit: After browsing the Django documentation, it appears that I'm right. While you can store the output of a view in the filesystem (or memcached, or whatever), cached hits still need to go through the framework to get dispatched. This appears to be the first way to skip the framework (aside from Squid or similar), which is what Rails' page caching does.
Page caching creates the cached page on the first request, and dishes out the cached output until it is swept (after a new create/update/delete). This seems like the "no duh" approach. The Django "standard" way of setting a timed expiration seems silly and inflexible.
It allows about 10x more requests.
His route seems to add another 10x worth of performance or something.
As to caching pages, timeouts, it is completely possible to cache things as they are created and make use of them. The timeout method is just the first, simplest way of caching saying (cache this one page for a minute, so when it gets YC'd, it only recalculates the page every minute)
That is exactly how page caching in Rails works, and has been implemented for two years. It seems like Django's idea of "page caching" is equivalent to Rails' "action caching".