On Fri, 2006-10-27 at 18:21 -0700, Rob Hudson wrote:
> We're looking at a way to "script out" a Django database driven website
> to static HTML files to be used to bundle and build a SCORM package.
> 
> At first I thought we could simply wget the version on the server and
> save each file.  But what seems better would be to write a script that
> iterates over the pages in the database, tells the Django template to
> compile the templates with the data, and save them out to .html files.
> Or at least that would give us more options on how the content is
> saved.
> 
> Is this possible?  Does the wget way sound easier?  Benefits either
> way?

The main difficulty with the script approach is making sure you actually
process every page. Does your page structure really correspond directly
the the rows in the tables in the database? Also, ensuring you process
them in the same way as they would be normally processed by a view (if
you want to use your real views, you have to simulate the middleware and
request stuff properly). Still, if you understand the conditions under
which your pages are generated, this should be relatively simple. The
test framework might help you there (some of the infrastructure in
django/test/ that Russell wrote supports setting up request fakery in
that fashion).

I've used the wget solution for regression testing: wget a couple of
root pages to extract the whole tree, make some changes to the code,
wget again to another directory and run diff against the results to
check that only the expected things changed. It generates a very usable
static version of a site. If you pass the right options to wget to
rewrite all the URLs correctly, it creates a perfect local copy.

If it was me wanting to generate a static site like this (I had to go
and look up what SCORM was), I would use the wget solution. It's fast
and a is going to extract pretty much exactly what a generic user will
see (the differences will be if you have any content that varies on
cookies or browser strings, mainly). Still, I'm a command-line junkie,
so my preferences may not be typical.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to