Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dump Django site to static HTML? [closed]

Tags:

I've determined that my local web hosting company cannot support Django.

  • They run Python 2.2.
  • No support for mod_python, FastCGI, or SCGI.
  • No support for mod_rewrite.

Any one of these prevent me from deploying my site as a Django app at that hosting service.

I realize that my site is basically static. I'm wondering if I can use Django caching to the filesystem, and deploy what's in that cache. Or else use wget to recursively capture my site running on localhost. Has anyone done this kind of operation? Is it possible, and is it worth the effort?

I realize that I have at least two other options:

  • Use a PHP CMS solution.
  • Switch my domain to another hosting service.

edit: Thanks everyone for the suggestions! I've sent an email to my hosting provider to give them a chance to offer me an upgrade. If they can't come through, I'm looking at WebFaction as a provider.

like image 930
Bill Karwin Avatar asked Dec 11 '08 01:12

Bill Karwin


2 Answers

StaticGenerator for Django is what you want. It's designed to pull Django views and save them as static HTML files. It's how I publish my site (http://nedbatchelder.com).

UPDATED: the original link is gone, but the package is on PyPI: http://pypi.python.org/pypi/staticgenerator

like image 115
Ned Batchelder Avatar answered Sep 23 '22 15:09

Ned Batchelder


Wget with the "-m" (mirror) switch is probably what you're looking for. The "cleaner" way of doing this might be to just take all of the content that normally would be passed by the context processor and manually compose it into your templates.

As an aside, that's a real bummer, man. The dynamic nature of Django is a large component of what makes it so great. If you're not going to use an absurd amount of transfer (let's say >10 GB), I could probably host you for free.

like image 45
Andrew Avatar answered Sep 21 '22 15:09

Andrew