reStructWeb is based on the following tools:

At present reStructWeb makes hardly more than 300 lines of code. Largest of work (the management of the reStructuredText format) is made by Docutils.

reStructWeb was tested on the following environments :

  • Red Hat 9
  • Red Hat 8.0
  • Debian Sarge
  • Python 2.2.2, 2.2.3, 2.3.3
  • apache 2.0.40
  • docutils snapshot téléchargé le 2 mai 2004

The program should work on any system supporting Python 2.2 (or more) and docutils

Principle and performances

The system used is very powerful. The majority of time, the pages are sent to the navigator directly by Apache (static pages). Two cases of figures will lead Apache to return the request on reStructWeb script:

  1. The URL required does not exist
  2. The URL required contains parameters

reStructWeb script will ask you to create a page in case it don't exist or will ask you for the modification of an existing page. It generates thereafter html pages in the various languages and Apache will be able to send them in a traditional way.

Apache requires a small configuration to redirect the requests towards reStructWeb. You can however configure to use reStructWeb in a traditional way like a cgi, for example:

With Apache settings

Without Apache setting

What reStructWeb is not

reStructWeb is a small script which I wrote for my needs only. It was not thought and not designed at all for a system having to be managed by several people. There is no management of users, no modifications history and the safety options are non-existent : The permission of modification of the site is based on a single password, the magicWord: -)


Do not let anonymous users modify the contents of your website. reStructWeb is not a Wiki. An badly-attentive user can divert the use of the reStructuredText to try to compromise the system. Example :

.. include:: /etc/passwd

It is thus possible to include the contents in the page of any file on the system (for which the user of apache as the rights for reading).

This said, it is very fast 1 , very light, very simple to implement (a single file and four parameters)

[1] It is not the reStructWeb script which is fast, but the Apache sending of static pages. What is practically always the case on my site.


  • Version 0.2 - magicword is now used when you want to create a link : download


Standalone mode

In this mode, there is no Apache configuration. You only need to to copy the script in the directory cgi-bin.

  1. Install docutilsDownload reStructWeb
  2. Copy the file in cgi-bin directory
  3. Modify if you need the parameters in
  4. Create the reStructWeb working directory
  5. Change the directory permissions (the user running apache must be able to modify and create files in this directory)
  6. Copy the templates files in the working directory: default.tmpl.frdefault.tmpl.en
  7. Test

Apache redirect mode

proceed as for the standalone mode and to configure Apache in the following way :

Script GET /cgi-bin/
Script POST /cgi-bin/
ErrorDocument 404 /cgi-bin/

My configuration

On my computer, the working directory is /home/web/david/ is copied in the/home/web/david/cgi-bin directory.

Here is my Apache configuration :

<Directory "/home/web/david/pages">
Options FollowSymLinks MultiViews +Includes
Script GET /drobert/admin
Script POST /drobert/admin
ErrorDocument 404 /drobert/admin
AddDefaultCharset UTF-8
<Directory "/home/web/david/pages/st">
Options Indexes FollowSymLinks MultiViews +Includes
AddDefaultCharset ISO-8859-1
<VirtualHost *>
DocumentRoot /var/www/
ErrorLog logs/
CustomLog logs/ combined
ScriptAlias /drobert/admin /home/web/david/cgi-bin/
Alias /drobert /home/web/david/pages/



The appearance of each page can be completely customized because the system uses templates. It is completely possible to make a really nice website by using reStructWeb (not like this one).

The templates are files with the .tmpl extension located in the working directory. You need a default template for each language your website support, thus,on my site, two files are present on the working directory :

  • default.tmpl.en

They are the default templates for all the pages, in French and English.

You can create templates specific to each page with the filename page_name.tmpl.en. For example if I want a customized template for the reStructWeb page, you just have to create the files restructweb.tmpl.en and``.

Templates variables

The template file is a pure html file in which a certain number of variables are replaced by dynamic contents. Currently, reStructWeb makes it possible to use the following variables :

Variables Replaced by
$title Title 2 of the page
$body Body of the page
$sourceUrl Page source url
$editUrl Page edit url
$enUrl English version url
$frUrl French version url
$lastModified Last modified date
[2] Title is defined in the reStructuredText (name of first section)

Bugs / To make

Other projects