Configuration of MoinMoin

MoinMoin is configured by changing the moin_config.py file, which normally sits besides your moin.cgi driver script. moin_config.py is imported by the MoinMoin main code early in a request cycle and is found because the current directory (i.e. that of moin.cgi) is part of the Python system path. Consequently, moin_config.py can sit anywhere in your PYTHONPATH.

Overview of configuration options

The following table contains default values and a short description for all configuration variables. Most of these can be left at their defaults, those you need to change with every installation are listed in the sample moin_config.py that comes with the distribution.

Used as the base URL for all public documents served by the wiki, especially the image files for the icons

url_schemas

[]

additional URL schemas you want to have recognized (list of strings)

Changing character sets

If you want to use MoinMoin with a character set other than Latin-1, you might or even have to change the default character sets for WikiNames in "moin_config.py". A safe default is US-ASCII, i.e.

upperletters = "A-Z"
lowerletters = "0-9a-z"

With that setting, you need to set "allow_extended_names=1" and use the special markup for extended WikiNames ["extended name"] to get any names with characters outside the core latin alphabet.

File attachments

The AttachFile action enables a page to have multiple attached files. Since file uploads could be abused for DoS (Denial of Service) attacks, AttachFile is an action that may be enabled by the wiki administrator. To do this, add "allowed_actions = ['AttachFile']" to your configuration file.

If you wiki has (or is expected to have) many file attachments, there is an option which will eliminate the CGI overhead associated with each retrieval of an attachment file.

There are two storage/retrieval models for file attachments:

Attachments are stored "privately" and can only be retrieved via a CGI GET (via URLs like http://myorg.org/mywiki/<SomePage>?action=AttachFile&do=get&target=filename.ext).

Attachments are stored into a directory directly accessible by the web server, and can thus be served directly by the webserver, without any invocation of MoinMoin (leading to URLs like http://myorg.org/mywikiattach/<Somepage>/attachments/filename.ext).

If the efficiency of serving file attachments is a concern, the second option is preferable, but it also requires additional configuration steps and possibly more rights on the host machine. Because of this, the first option is the default; attachments are stored in the "...mywiki/data/pages/" directory, with paths like "...mywiki/data/pages/<pagename>/attachments/<filename>".

The MoinMoin attachments configuration option allows you to move the directory structure used to store attachments to another location. Unless you have a reason for doing so, there is no need to use a different location. Using a different location may be more work and more risk, as all the existing attachments must be copied to the new location. The following instructions are for Apache servers and assume you intend to leave the attachment files in their existing location and your original installation used the name "mywiki".

The first step is to tell Apache that it has another Alias directory from which it can serve files. Review the changes you made to the httpd.conf (or commonhttpd.conf) file during the MoinMoin installation and find the ScriptAlias statement similar to the following:

ScriptAlias /mywiki ".../mywiki/moin.cgi"

Create an Alias statement similar to the ScriptAlias statement above, replacing the

/mywiki URI with /mywikiattach/ and replacing moin.cgi with data/pages/.

Alias /mywikiattach/ ".../mywiki/data/pages/"

Be sure to note the differences in the trailing slashes between the two statements, they must be entered exactly as shown above. If you are making this change to a running system, you must restart Apache to have the change take effect.

The second step is to tell MoinMoin to let Apache do the work of fetching file attachments. To do this, you need to add an attachments option to .../mywiki/moin_config.py. The 'attachment' option is a dictionary of two values:

dir value above tells MoinMoin where to store attachments; note this is the same as the path in the new Apache Alias statement but without the trailing "/". The url value tells MoinMoin how to retrieve the attachments; this matches the URI in the Alias statement but again without the trailing "/".

After you have completed the configuration changes, test by uploading an attachment for WikiSandBox. Then modify the WikiSandBox page to display the uploaded image or download the file. If there were existing attachments before this change, verify the old attachments are still available. Finally, review the Apache

access.log file to verify you have a log entry showing the expected file access: