Ophelia


Deutsche Fassung

What is Ophelia?

Ophelia is a Python package that assembles XHTML pages from templates. It is used on a web server to generate each page at the moment it is requested.

Ophelia avoids repetitive code.
Text and HTML structures common to all pages in a directory are stored in a shared common template. What templates a web page consists of and in which way they are combined follows directly from the URL. Thus, it is not even necessary to write for each page which templates it needs to use.
Ophelia is dynamic.
Templates are written in TAL, the Template Attribute Language of Zope. TAL is XHTML with the added possibility to acquire the content of DOM elements and attributes from context variables. The context is modified by Python scripts. A template shares a file with its corresponding script to make for easy handling, but there's still a clean separation of Python code from XHTML content.
Ophelia works on files.
All templates and scripts reside in the server's file system. Therefore, one can edit and version-control the contents of one's pages easier than using a relational or object database. On the other hand, one would certainly not want to program complex applications in this manner; Ophelia can't be recommended for anything more than «SSI on drugs».

Ophelia is currently used to serve a few web sites, among them this one. See Powered sites for others.

Using Ophelia

After you installed Ophelia and wrote some templates, how can you make it render web pages? Version 0.4 implements the Ophelia request handler as a WSGI application which can be used in any of the following ways (and more):

The Ophelia documentation entails a small example project which has been installed and is explained at this site.

For a more technical description, see the project's documentation.


2017/08/24