We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

The Django PageView Application

March 2006 | Fredrik Lundh

This is a work in progress.

Powered by Django.

The pageview mini application is a fast and efficient dynamic front-end renderer, which can reformat HTML and XHTML pages from external sources on the fly. This can be useful when you want to:

  • publish information from an existing content management system
  • republish pages from an external source
  • use a standard wiki to maintain the site, behind the scenes
  • allow users to choose between different templates, depending on preferences or user agent.
  • experiment with different styles, without having to generate multiple copies of an entire site.

The application uses tidy to clean up the source material as needed, and cElementTree to pull out relevant XHTML fragments from it. Django’s template engine is then used to render output pages, and Django’s caching system is used to cache rendered pages in memory (e.g. via memcached).

The application maintains a page mapping database which controls how URL are mapped to individual pages. You can use Django’s administration interface to remap or redirect pages. Since each page has an entry in this database, you can add Django comments and other features to any or all pages on the site.

The application is based on the work done for the AltPyDotOrgCMS project (also see this sketch), where it was used to render pages from wiki source content.

Download

The code is currently only available via subversion:

   $ svn co http://svn.effbot.org/public/pydotorg/page

For installation tips, see this article.

The current version is written for Django 0.91, and includes sample parsers for old-style www.python.org contents, latex-generated docs.python.org pages, effbot.org zone articles, pyref and pyfaq pages, and pages rendered in moinmoin‘s default style.

Examples

You can find some minimally styled sample output here: python-1 python-2, moinmoin-1, effbot-1, pyref-1.

Here are some samples rendered with a python.org-style template: “asyncore — Asynchronous socket handler” (from the pyref project), “Can’t find what you’re looking for?“, “Why Work on Python?“, and “PythonDoc” (from effbot.org).