

Generate Static html cache files automatically in django - nikolaj
http://superjared.com/entry/announcing-staticgenerator-django/
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.
======
carpal
Is this seriously the first implementation of this in Django?

I 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.

~~~
nikolaj
the difference here is that the html files are served by nginx, before django
is event touched. Removing Django from the equation (and fastcgi or modpython
or whatever nginx is proxying too) is where the speedup comes from. This isn't
"caching" as much as it is fairly smoothly making certain areas of the site
static html.

~~~
carpal
Yes, that's exactly my point. Is this the first approach that does this within
the Django framework?

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".

~~~
nikolaj
i see your point. i would assume someone else has done this before in django,
but regardless, i thought it was interesting as i haven't seen something like
this as easily accessible for us django people.

------
imsteve
Generating is never the hard part, it's keeping the cache current, pruning it
when it gets too big, etc. that's hard. (Ok, I didn't read the article, yet.)

~~~
superjared
Hopefully what I created is elegant enough for people to want to use.

~~~
imsteve
yeah it seems simple, that's good. And bypasses the framework, that's very
good.

------
superjared
woot, i got news'd

