Voidspace

rest2web: Building Websites Across the Known Universe

Configuring rest2web

The Config File

Configuring

emoticon:noise rest2web needs to receive certain configuration details which it gets from a config file. By default this is called 'rest2web.ini' and is located in the same directory as rest2web.py. You can supply an alternative config file path at the command line, when you run rest2web.py.

rest2web.py ../path/to/rest2web.ini

The options all look something like :

start_directory = "../../source_directory"

The quotes are optional.

Note

rest2web uses ConfigObj to read config files. ConfigObj uses a very simple ini style syntax. If you want to check out the full syntax spec, you'll need to read the ConfigObj Docs.

Config Options

The full list of config options is :

  • 'start_directory'
  • 'target_directory'
  • 'compare_directory'
  • 'log_file'
  • 'macros'
  • 'psyco'
  • 'pause'
  • 'DEBUG' (optional)

The options are explained in the config file, but there is also a full explanation below. The config options are case sensitive. The only one that is optional is DEBUG, all the other options must be present or restweb will fail.

Directory Paths

  1. 'start_directory'
  2. 'target_directory'
  3. 'compare_directory'

rest2web reads source files and outputs HTML. THhe directory it reads files from is the - 'start_directory'. This will be the top level for your website.

It also needs to know where to put the files it generates - the 'target_directory'.

The directory structure of the resulting website will be created in the 'target_directory'. Existing files will be overwritten without confirmation, but files that don't need to be overwritten won't be deleted.

When rest2web generates files it compares them against existing files to see if the file has changed. This can be useful if you want your target directory to only contain files that have changed (for uploading the new and changed files by FTP). In this case you may want to specify a 'compare_directory' that is different from the 'target_directory'.

If you don't specify a 'compare_directory' (set the value to '') then the 'target_directory' is used.

log_file

'log_file' is the path to a file for logging the results of running rest2web. This includes any errors that may occur.

If you set it to '' then no log file will be generated.

macros

This option is the path to the 'macros' file.

This should be a file called 'macros.py' and contains the macros in your templates and pages. For details of how this works, please see the macros page. This option allows you to have different macro files for all the sites that you create with rest2web.

If you set it to '', then no macros file will be used for this site.

psyco

'psyco' should be set to True or False. If True, rest2web will attempt to use psyco.full().

If you have psyco installed rest2web runs faster, but I have had a problem with psyco reported on one Linux platform.

Not having psyco installled and setting this value to True will have no effect. It won't prevent rest2web from running though.

Note

If you want psyco for windoze, the latest version is only available from SVN repository.

You can obtain precompiled binaries for windows from http://www.voidspace.org.uk/python/modules.shtml#psyco.

pause

'pause' should be set to True or False. If True, after finishing rest2web will wait for the user to hit enter before exiting.

This can be ueful on the Windoze platform where you launch rest2web by double clicking on rest2web.py.

DEBUG

This value is optional. 'DEBUG' should be set to True or False. If True, then before rendering each page rest2web will drop you into an interactive interpreter session inside the namespace of the page.

As well as all the normal values in the namespace there is an exit() function which calls sys.exit(). You also have the values local_vars, self and temp_file. These are the local variables from where the namespace was built, the processor object, and the template file.

Return to Top
Part of the rest2web Docs
Page last modified Thu Mar 30 17:04:24 2006.


Site Built with rest2web SourceForge.net Logo Certified Open Source

Python on Voidspace