Python script to generate static site?

John Hunter jdhunter at ace.bsd.uchicago.edu
Thu Aug 12 09:17:39 EDT 2004


>>>>> "Fred" == Fred  <fred at acme.com> writes:

    Fred> Hi, I'm sure there are a bunch of them, but googling just
    Fred> returned full-fledged CMS that require a DBMS and generate
    Fred> dynamic pages.

    Fred> I'd just like a script that would 1. look in a directory for
    Fred> articles in raw HTML, 2. generate a cooked output for each
    Fred> page (ie. add header and footer, CSS link in HEAD, etc.),
    Fred> 3. regenerate the homepage with "Last modified" bit
    Fred> following each article's title, 4. ready to be uploaded by
    Fred> FTP to a web server that only handles static web pages.

    Fred> Considering Python's wealth of libraries, it's most likely
    Fred> only a couple hours' work, but since I'm pretty much a
    Fred> Python newbie...

yaptu is python templating code (79 lines long!).  I use it to
(statically) generate the entire matplotlib web site -
http://matplotlib.sourceforge.net.  This includes parsing pydoc output
to embed it into the web site navigation tables, adding headers /
footers, etc.  I think it's great - it's really easy to mix python &
html


see http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52305.  If
you want more extensive examples, look in the *.html.template files of
the htdocs subdirectory of a matplotlib cvs checkout.

JDH



More information about the Python-list mailing list