HelpContents > HelpOnAdministration > HelpOnConfiguration

Subtopics

Index

  1. Configuration of MoinMoin
    1. Overview of configuration options
    2. Changing character sets
    3. File attachments

1. 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.

1.1. 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.

Variable name Default Description
LogStore 'text:editlog' Experimental, keep the default
SecurityPolicy None class object hook for implementing security restrictions
allow_extended_names 1 true to enable ["non-standard wikiname"] markup
allow_subpages 1 true to enable hierarchical wiki features (see HelpOnEditing/SubPages)
allow_numeric_entities 1 if true, numeric entities like € for € are not escaped, but & and stuff still is
allow_xslt 0 true to enable XSLT processing via 4Suite (note that this enables anyone with enough know-how to insert arbitrary HTML into your wiki, which is why it defaults to 0)
allowed_actions [] allow unsafe actions (list of strings)
attachments None If None, send attachments via CGI; else this has to be a dictionary with the path to attachment storage (key dir) and the equivalent URL prefix to that same dir (key url)
backtick_meta 1 true to enable `inline literal` markup
bang_meta 0 true to enable !NoWikiName markup
changed_time_fmt '  [%H:%M]' Time format used on RecentChanges for page edits within the last 24 hours
charset 'iso-8859-1' The encoding / character set your system uses
check_i18n 0 Set to 1 only in development systems, or on a translator's system
css_url "<url_prefix>/css/moinmoin.css" URL for the default CSS definitions, make this a server-relative URL (start with a slash)
data_dir './data/' Path to the data directory, the default is OK if you place the data directory right besides your moin.cgi
date_fmt '%Y-%m-%d' System date format, used mostly in RecentChanges
datetime_fmt '%Y-%m-%d %H:%M:%S' Default format for dates and times (when the user has no preferences or chose the "default" date format)
default_lang 'en' default language for page contents, and also the default user language if not set by other means
default_markup 'wiki' Default page parser / format (name of module in MoinMoin.parser)
edit_locking 'warn 10' Editor locking policy: None, 'warn <timeout in minutes>', or 'lock <timeout in minutes>'
edit_rows 30 Default height of the edit box
external_diff 'diff' Allows you to set an exact path to the command, or change the name to for example "gdiff" if GNU diff is not a native command in your UNIX flavour
hosts_deny [] List of denied IPs; if an IP ends with a dot, it denies a whole subnet (class A, B or C)
html_head META-Tag with Content-Type Additional <HEAD> tags for all pages (see HelpOnSkins)
html_head_queries META-Tag with "NOINDEX,NOFOLLOW" for robots Additional <HEAD> tags for edit and action pages (html_head is sent, too; see HelpOnSkins)
html_pagetitle None Allows you to set a specific HTML page title (if not set, it defaults to the value of sitename)
httpd_docs './wiki-moinmoin' directory with public files, when using the stand-alone server
httpd_host 'localhost' hostname of the stand-alone server
httpd_port 8080 port of the stand-alone server
httpd_user 'nobody' user to run the stand-alone server under (UNIX only)
interwikiname None InterWiki name (prefix, moniker) of the site, or None
logo_string '<img src="%s" border="0" alt="%s">' % (logo_url, sitename) The img tag used to format the logo display in the upper-left corner of a page and used in RSS documents
logo_url MoinMoin logo The URL path to the logo used by logo_string above
lowerletters Latin 1 alphabetic characters and digits Lowercase letters, used to define what is a WikiName
mail_from None From: header used in sent mails
mail_smarthost None IP or domain name of an SMTP-enabled server; note that email features (notification, mailing of login data) works only if this variable is set
max_macro_size 50 Maximum size of some macro pages in KB, especially used to limits the size of RecentChanges; use 0 to disable that feature
navi_bar list of default quick links Most important links in text form (these links can be over-ridden by the user's quick links); to link to any URL, use a free-form link of the form "[url text]"
nonexist_qm 0 Default for displaying WantedPages with a question mark, like in the original wiki (changeable by the user)
page_category_regex '^Category[A-Z]' Pages matching this regex are regarded as Wiki categories
page_footer1 Python Powered logo Custom HTML markup sent before the system footer (see HelpOnSkins)
page_footer2 "" Custom HTML markup sent after the system footer (see HelpOnSkins)
page_form_regex '[a-z]Form$' Pages matching this regex are regarded as containing form definitions
page_front_page 'FrontPage' Name of the front page
page_icons large HTML fragment The top-right icons on each page
page_icons_up icon for link to parent This icon is shown on subpages and links to the parent page
page_local_spelling_words 'LocalSpellingWords' Name of the page containing user-provided spellchecker words
page_template_regex '[a-z]Template$' Pages matching this regex are regarded as templates for new pages
shared_intermap None path to a file containing global InterWiki definitions (or a list of such filenames)
shared_metadb None path to a file containing a global InterWiki pagelist (not yet implemented)
show_hosts 1 true to show hostname in RecentChanges
show_section_numbers 1 true to show section numbers in headings by default
show_timings 0 used for development
show_version 0 show MoinMoin's version at the bottom of each page
sitename 'An Unnamed MoinMoin Wiki' Short description of your wiki site, displayed below the logo on each page, and used in RSS documents as the channel title
smileys {} User-defined smileys (a dict with the markup as the key and a tuple of width, height, border, image name as the value)
title1 None HTML fragment before title area (see HelpOnSkins)
title2 '<hr>' HTML fragment after title area (see HelpOnSkins)
trail_size 5 Number of pages in the trail of visited pages
ua_spiders ...|google|wget|... A regex of HTTP_USER_AGENTs that should be excluded from logging
umask 0755 umask used on all open(), mkdir() and similar calls
upperletters Latin 1 alphabetic characters Uppercase letters, used to define what is a WikiName
url_mappings {} lookup table to remap URL prefixes (dict of 'prefix': 'replacement'); especially useful in intranets, when whole trees of externally hosted documents move around
url_prefix '/wiki' 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)

1.2. 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.

1.3. File attachments

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

There are also two storage/retrieval models for file attachments:

  1. attachments are stored "privately" and can only be retrieved via a CGI GET (via URLs like http://wiki.net/moin/SomePage?action=AttachFile&do=get&target=filename.ext).

  2. 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://wiki.net/wiki/mywiki/SomePage/attachments/filename.ext).

Generally, the second option is preferable1, but it also requires additional configuration steps, and possibly more rights on the host machine. Because of that, the first option is the default; attachments are stored in the "data" directory, with paths like "<data>/pages/<pagename>/attachments/<filename>".

For the second option, you need to add an attachments option to your configuration, which is a dictionary of two values:
attachments = {
    'dir': 'C:/Moin/share/moin/htdocs/mywiki',
    'url': '/wiki/mywiki',
}

dir is the file system path to the attachment storage, and url is the matching URI to get access to that directory. That directory has to exist and be writable for the webserver, so it can create the necessary directories and files for new attachments. Note that you have to manually create this directory, MoinMoin will not create it for you.

The above example shows a typical configuration for Windows that works for an installation according to the default setup procedure (see ?HelpOnInstalling/ApacheOnWin32). For UNIX, if you followed ?HelpOnInstalling/ApacheOnUnix, the necessary configuration will look like this:

attachments = {
    'dir': '/usr/local/share/moin/htdocs/mywiki',
    'url': '/wiki/mywiki',
}

After you have completed the configuration changes, try to create an attachment for WikiSandBox to check for any errors. If you have any permission problems, you will likely see a Python traceback or some error message.