Why all these static site generators? Just use Varnish, it is the static site generator for any and all frameworks.
Do you have access to Varnish in your standard run-of-the-mill shared host service?
Django-medusa: Rendering Django sites as static HTML
11–20 of 23 posts
Re: Django-medusa: Rendering Django sites as static HTML
#12I just don't see the point to this kind of stuff.. =/ For high traffic apps, Varnish is the answer as you don't hit the application layer. If you think that's too complicated, try nginx-memcached - also an excellent solution. If not that, try django's template caching with memcached - also extremely fast but will hit the application layer. If you're in some shared hosting environment (you probably are too small still…
Static files on S3 are far simpler than setting up Varnish and coming up with a reasonable strategy for cache invalidation. Varnish is great, but I don't know anyone who would describe setting it up as "simple." This solution, on the other hand, looks quite simple.
Re: Django-medusa: Rendering Django sites as static HTML
#13Earlier quoted context omitted.
Yeah, deployment scenarios where you have no application layer, and can only deploy static assets (S3, GitHub pages and the likes).
That's interesting. So basically it's for rendering pages and then pushing them on to S3/Other-static-storage and serving them from there ? I don't see any particular gains however since high traffic pages (static or otherwise..) served off S3 will end up costing way more than on a shared host/dedicated server. What would be an exact use case where this would really be important and help out ? I'm just trying to unde…
We ended up developing both sites in django, which made it easy for them to add copy during development and see how it would actually look on the site. Once finished, we got the HTML output and sent it over for them to put up on their servers.
We were pretty happy with how it turned out, and I think django-medusa being able to automate the whole rendering to html files would be nice if we have to do it again.
Re: Django-medusa: Rendering Django sites as static HTML
#14Earlier quoted context omitted.
That's interesting. So basically it's for rendering pages and then pushing them on to S3/Other-static-storage and serving them from there ? I don't see any particular gains however since high traffic pages (static or otherwise..) served off S3 will end up costing way more than on a shared host/dedicated server. What would be an exact use case where this would really be important and help out ? I'm just trying to unde…
Our last 2 clients have asked for static solutions because they don't have the capacity to maintain django apps down the line and don't want to hire new staff or continue paying us for maintenance. We ended up developing both sites in django, which made it easy for them to add copy during development and see how it would actually look on the site. Once finished, we got the HTML output and sent it over for them to put…
Well, in that case I can see how this tool could be really handy! Thanks for the input :)
Re: Django-medusa: Rendering Django sites as static HTML
#15I just don't see the point to this kind of stuff.. =/ For high traffic apps, Varnish is the answer as you don't hit the application layer. If you think that's too complicated, try nginx-memcached - also an excellent solution. If not that, try django's template caching with memcached - also extremely fast but will hit the application layer. If you're in some shared hosting environment (you probably are too small still…
In most applications I work on, I lovingly use and abuse Memcached, Redis, and Varnish. If you’re working on an application that warrants using a live website and the whole application server shebang, then yes, I’d agree with you.
But for something like my blog and other non-dynamic websites which don’t update very much at all, I’m not sure if I see a pressing need for an application server. My blog previously ran varnish-nginx-uwsgi-django, but I was moving off of a VPS and it was the last thing left on that server. I got curious.
In the case of something like the L.A. Times’ Data Desk[2] projects (who use their own django-bakery app), if some views are very expensive/slow to generate, you can offload the work from the application server and do it in advance. (This makes sense if you want to just render everything out on a fast workstation or if you have a local database of several hundred gigabytes that you don’t want a live server querying to crunch the data.) It’s not out of the question to pregenerate HTML pages, JSON for visualizations, and simple image files (generated in PIL).
In any case: it’s not so much a question of “high traffic apps” as much as the tradeoff between (computation cost + server maintenance cost) and (app that is server-side dynamic or updates frequently). Most people don’t want to configure and maintain an app server (with cache layers and all) for a simple app and those that don’t seem to have uptime issues the moment they get any legitimate traffic: see [3].
So:
* I decided I didn’t want to maintain an app server for my blog, and my historical average for updates is about once every four weeks (or even more infrequent). * People seemed to be big fans of Jekyll/Hyde, Movable Type’s static publishing mode[4], WP Super Cache, etc. * I felt a Django-friendly analogue to those would be cool. * Like any developer tinkering with their own blog, there didn’t have to be a point.
[1]: http://pypi.python.org/pypi/hyde/ [2]: http://datadesk.latimes.com/ [3]: http://inessential.com/2011/03/16/a_plea_for_baked_weblogs [4]: http://daringfireball.net/linked/2011/03/18/brent-baked
Re: Django-medusa: Rendering Django sites as static HTML
#16Why all these static site generators? Just use Varnish, it is the static site generator for any and all frameworks.
What if you don’t want to use your own infrastructure? (See Ars Technica’s WWDC liveblog[1], which polls JSON files that are in the same directory and appeared to be periodically updated during the event, by some software that a reporter was using. Ostensibly because the feature is short-lived, super-high-traffic — likely thousands of concurrent users — and should be as low latency as possible due to the nature of the event.)
Not to knock on Varnish, because I use it on plenty of larger things and love it. I just think that there are usecases where you can rationalize not even having an application server to cache in front of.
[1] https://s3.amazonaws.com/liveblogs/wwdc-keynote-2012/index.h...
Re: Django-medusa: Rendering Django sites as static HTML
#17Earlier quoted context omitted.
Yeah, deployment scenarios where you have no application layer, and can only deploy static assets (S3, GitHub pages and the likes).
That's interesting. So basically it's for rendering pages and then pushing them on to S3/Other-static-storage and serving them from there ? I don't see any particular gains however since high traffic pages (static or otherwise..) served off S3 will end up costing way more than on a shared host/dedicated server. What would be an exact use case where this would really be important and help out ? I'm just trying to unde…
Re: Django-medusa: Rendering Django sites as static HTML
#18Does it handle images? How about multiple sites/subdomains?
Re: Django-medusa: Rendering Django sites as static HTML
#19I just don't see the point to this kind of stuff.. =/ For high traffic apps, Varnish is the answer as you don't hit the application layer. If you think that's too complicated, try nginx-memcached - also an excellent solution. If not that, try django's template caching with memcached - also extremely fast but will hit the application layer. If you're in some shared hosting environment (you probably are too small still…
It was an itch I wanted to scratch. I’d been tempted to convert my entire (Django-based) blog over to something like Hyde[1], but wanted a bit more flexibility than the framework provided. In most applications I work on, I lovingly use and abuse Memcached, Redis, and Varnish. If you’re working on an application that warrants using a live website and the whole application server shebang, then yes, I’d agree with you.…
Re: Django-medusa: Rendering Django sites as static HTML
#20Very cool project, thanks for open sourcing it. I was looking for this type of library this week and found medusa and aymcms. Does it handle images? How about multiple sites/subdomains?
For more dynamic file storage (say, using FileField or ImageField in a model), I believe django-storages would work, too. (Make sure you configure django-storages with the DEFAULT_FILE_STORAGE option set to S3 also.)
Assuming you’re managing your site via a local dev server (or a server that "hosts" the "hot type" version of the site), any time you "upload" a file to your local server, it'll actually upload to S3 (and any calls to "field.url" will actually map to the S3 URL). Not sure how well it'll work in all use cases: I haven't actually used FileField or ImageField myself in the django-medusa+django-storages usecase, but I have used both separately so I’m fairly sure this is possible.
This is a pretty darn good question though, so I’ll likely make a follow-up blogpost with a more comprehensive walkthrough regarding handling staticfiles and FileField/ImageField. Sometime in the near future.
Multiple sites/subdomains is a bit more complicated. I’d say you should probably use separate Django instances for each and render them separately. (For S3, you’d need to use separate buckets, anyway.) If they need to share data, you can configure multiple Django settings.py configurations for each site but still use the same source tree and local database. (See the Django sites framework: [3])
[1]: https://docs.djangoproject.com/en/dev/howto/static-files/ [2]: http://django-storages.readthedocs.org/en/latest/backends/am... [3]: https://docs.djangoproject.com/en/1.4/ref/contrib/sites/