David ROBERT website- Home page


reStructWeb is a small piece of software written in Python language. I wrote it to manage my personal web site. The most important features that I wished when I decided to write it are :

I took as a starting point the the Wiki system to update my Web site. The pages are created in text format using the reStructuredText format. Look for example at the source of this document clicking on the Source link in bottom of this page.



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 :

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.



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 docutils, Download reStructWeb
  2. Copy the file rstgen.py in cgi-bin directory
  3. Modify if you need the parameters in rstgen.py
  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.fr, default.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/rstgen.py
Script POST /cgi-bin/rstgen.py
ErrorDocument 404 /cgi-bin/rstgen.py

My configuration

On my computer, the working directory is /home/web/david/pages, rstgen.py 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 *>
  ServerAdmin webmaster@ombrepixel.com

  DocumentRoot /var/www/ombrepixel.com
  ServerName www.ombrepixel.com
  ServerAlias ombrepixel.com
  ErrorLog logs/www.ombrepixel.com-error_log
  CustomLog logs/www.ombrepixel.com-access_log combined
  ScriptAlias /drobert/admin /home/web/david/cgi-bin/rstgen.py
  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.fr
  • 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 restructweb.tmpl.fr``.

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