welcome: please sign in

Upload page content

You can upload content for the page named below. If you change the page name, you can also upload content for another page. If the page name is empty, we derive the page name from the file name.

File to load page content from
Page name
Comment

location: 帮助-系统设置

(!) Last time someone helped with translation of this page was 2006-03-23. There may be differences to HelpOnConfiguration.

我们简单地把英文的系统设置帮助包含在这里, 如果您有时间, 请帮忙翻译成简体中文。为了正确地使用简体中文,除了英文系统必要的一些设置外,还需要在wikiconfig.py中设置如下的选项:

变量名 缺省 中文系统支持
page_category_regex ur'(?P<all>Category(?P<key>\S+))' ur'(?P<all>(?P<prefix>Category)?(?P<key>\S+)(?(prefix)|类))'
page_dict_regex ur'(?P<all>(?P<key>\S+)Dict)' ur'(?P<all>(?P<key>\S+)(Dict|字典))'
page_group_regex ur'(?P<all>(?P<key>\S+)Group)' ur'(?P<all>(?P<key>\S+)(Group|组))'
page_template_regex ur'(?P<all>(?P<key>\S+)Template)' ur'(?P<all>(?P<key>\S+)(Template|模板))'
page_include_regex u'.+Inc$|.+Inc/' u'.+Inc$|.+Inc/'

帮助目录 > 帮助-系统管理 > 帮助-系统设置

子页面

目录

配置单独的维基

如要运行单独的维基, 你不需要复制“farmconfig.py”文件到配置目录中(删除它和“.pyc”文件,如果它们在那里)。如果没有farmconfig,moin就使用默认的wikiconfig.py

wikiconfig.py一般和您的moin.cgi脚本放置在一起。如果你想自定义安装,那么它可以放置在任何地方,但是你必须把它所在的目录加入到你的服务器脚本的Python系统目录中。参考您的服务器脚本中“系统路径配置”一节。

维基配置文件结构

wiki/farmconfig.py 结构:

# -*- coding: iso-8859-1 -*-

from MoinMoin.multiconfig import DefaultConfig

class Config(DefaultConfig):

    sitename = u'MyWiki'   # u 意味着字符串转化为Unicode格式
    interwikiname = 'MyWiki'
    data_dir = '/where/ever/mywiki/data/'
    underlay_dir = '/where/ever/mywiki/underlay/'
    
    # 更多设置...

Unicode选项

有一些配置必须使用unicode表示。例如,网站名称(site name)可能包含德语/法语/汉语/阿拉伯语/。因此,你必须使用unicode字符串表示这些配置。 Unicode字符串通过前置字母u表示。下面是一些例子:

    # 网站名称,默认用于wiki名称logo [Unicode]
    sitename = u"Jürgen's Wiki"
    # 另一个例子:
    sitename = u'הוויקי של יורגן''

请阅读配置文件中的注视,其中会提示那些选项必须使用unicode表示。

注意:

国际化设置

默认的配置文件是iso-8859-1编码。对于拉丁语系的语言,比如英语、德语,这种编码没有任何问题,但是对于非拉丁语系的语言就不适用了。如果你要在配置文件中使用非拉丁字符,请将配置文件用utf-8编码。

设置所有配置文件的第一行如下:

# -*- coding: utf-8 -*-

使用unicode字符串的选项 (国际化用户可能会修改它们):

For ready made configuration in your language, see MoinMoin:ConfigMarket. Read also the section about unicode options.

配置多个维基

MoinMoin可以在仅安装一次、单独配置文件、单独服务器进程的情况下,处理多个维基。特别是对像twisted这样的持久运行环境,这个功能是很有必要的,因为twisted服务器可能会在特殊的IP地址和TCP端口长久运行。所以对于一个IP和端口上的多域(维基)的虚拟主机,需要维基引擎持续能够同时加载多个配置并正确处理访问请求。

为了选择正确配置,moin使用配置文件farmconfig.py中的变量wikis - 其包含(wikiname, url-regex)一对对的列表。 wikiname只能使用正确的python语法(确切的说: identifier ::= (letter|"_") (letter | digit | "_")* - 如果你不能理解这个语法,那么使用简单的单词就可以了)。当处理对某个URL的访问请求时,moin搜索这个列表,试图匹配URL。如果不能匹配,则试图匹配下一对。如果匹配,moin加载名为<wikiname>.py的配置文件(通常位于相同目录) 。

发行包中的farmconfig.py文件包含一些维基农场(wiki farm)的配置例子。你应该修改这个文件以适应自身的需要。

/!\ 为了简化帮助文件的编写,我们将这些<wikiname>.py配置文件称为wikiconfig.py,你应该根据自己的需要使用适当的文件名。

既然你已经修改了farmconfig.py中的设置(见上),我们在这里只给一些提示,希望可以节省你的时间。同时请你阅读单独的维基配置提示,因为在那里已经解释了配置继承的原理。

现在我们使用基于类的配置在一个单独的位置设置常用选项,这就是配置基类。(请看farmconfig.py中的例子):

farmconfig.py:

# -*- coding: iso-8859-1 -*-
# farmconfig.py:
from MoinMoin.multiconfig import DefaultConfig
class FarmConfig(DefaultConfig):
    url_prefix = '/wiki'
    show_hosts = 1
    underlay_dir = '/where/ever/common/underlay'
    # ...

这样一来,每个单独的维基只需要设定各有不同的设置选项即可(比如logo,数据目录或者ACL设置)。其他的设置都从基本配置类中继承而来,请看moinmaster.py示例:

moinmaster.py:

# -*- coding: iso-8859-1 -*-
# moinmaster.py:
from farmconfig import FarmConfig
class Config(FarmConfig):
    show_hosts = 0
    sitename = u'MoinMaster'
    interwikiname = 'MoinMaster'
    data_dir = '/org/de.wikiwikiweb.moinmaster/data/'
    # ...

配置选项总览

下面的表格包含所有配置变量的默认值和简短描述。大部分选项可以使用默认值,无须改动。每次安装都需要改动的选项已经写在发行包中自带的wikiconfig.py文件中了。

/!\ 从moin 1.3.1开始,有些选项必须使用unicode字符串。请阅读unicode选项一节的内容。

变量名

默认值

描述

SecurityPolicy

None

Class object hook for implementing security restrictions

acl_...

...

wiki-wide access control list definition (see HelpOnAccessControlLists)

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)

actions_excluded

[]

Exclude unwanted 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)

auth

[moin_cookie]

list of auth functions, to be called in this order (see HelpOnAuthentication)

bang_meta

1

enable !NoWikiName markup

caching_formats

['text_html']

output formats that are cached; set to [] to turn off caching (useful for development)

changed_time_fmt

'%H:%M'

Time format used on RecentChanges for page edits within the last 24 hours

chart_options

None

If you have gdchart, use something like chart_options = {'width': 720, 'height': 540}

cookie_domain

None

farmconfig: use this domain for the MoinMoin cookie

cookie_path

None

farmconfig: use this path for the MoinMoin cookie

cookie_lifetime

12

12 hours from now until the MoinMoin cookie expires and you get logged out

data_dir

'./data/'

Path to the data directory containing your (locally made) wiki pages.

data_underlay_dir

'./underlay/'

Path to the underlay directory containing distribution system and help pages.

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_markup

'wiki'

Default page parser / format (name of module in MoinMoin.parser)

docbook_html_dir

'...'

Path to the docbook html directory (optional, used by the docbook parser). The default value is correct for Debian Sarge.

editor_default

'text'

Editor to use by default, 'text' or 'gui'

editor_ui

'freechoice'

Editor choice shown on the user interface, 'freechoice' or 'theonepreferred'

editor_force

False

Force using the default editor

editor_quickhelp

{'wiki':"...", 'rst':"..."}

Quickhelp provided at the bottom of edit pages. To customize, specify a dictionary with key matching default_markup (e.g. 'wiki') and give a string value containing wiki markup

edit_locking

'warn 10'

Editor locking policy: None, 'warn <timeout in minutes>', or 'lock <timeout in minutes>'

edit_rows

20

Default height of the edit box

hacks

{}

for use by moin development

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

""

Additional <HEAD> tags for all pages (see HelpOnSkins)

html_head_posts

robots: noindex,nofollow

Additional <HEAD> tags for POST requests

html_head_index

robots: index,follow

Additional <HEAD> tags for some few index pages

html_head_normal

robots: index,nofollow

Additional <HEAD> tags for most normal pages

html_head_queries

robots: noindex,nofollow

Additional <HEAD> tags for requests with query strings, like actions

html_pagetitle

None

Allows you to set a specific HTML page title (if not set, it defaults to the value of sitename)

interwiki_preferred

[]

In dialogues, show those wikis at the top of the list.

interwikiname

None

InterWiki name (prefix, moniker) of the site, or None

language_default

'en'

Default language for user interface and page content, see HelpOnLanguages!

language_ignore_browser

False

Ignore user's browser language settings, see HelpOnLanguages!

logo_string

sitename

The wiki logo top of page, HTML is allowed (<img> is possible as well) [Unicode]

lupy_search

False

use the lupy indexing search engine (DEPRECATED, gone in 1.6)

mail_from

None

From: header used in sent mails, e.g. mail_from = u'Jürgen Wiki <noreply@example.com>'. See /EmailSupport.

mail_import_subpage_template

u"$from-$date-$subject"

This is the template for the pagename generated by the mail import code. See /EmailSupport. New in 1.6.

mail_import_wiki_address

None

The e-mail address of the e-mails that should go into the wiki See /EmailSupport. New in 1.6.

mail_import_secret

""

The secret that matches the mailimportconf.py configuration file. See /EmailSupport. New in 1.6.

mail_login

None

"user pwd" if you need to use SMTP AUTH

mail_smarthost

None

IPv4 address or hostname of an SMTP-enabled server (with optional :port appendix, defaults to 25). Note that email features (notification, mailing of login data) works only if this variable is set.

mail_sendmail

None

If set to e.g. '/usr/sbin/sendmail -t -i', use this sendmail command to send mail. Default is to send mail by an internal function using SMTP.

navi_bar

[u'%(page_front_page)s', u'RecentChanges', u'FindPage', u'HelpContents',]

Most important page names. Users can add more names in their quick links in UserPreferences. To link to URL, use u"[url link title]", to use a shortened name for long page name, use u"[LongLongPageName title]". To use page names with spaces, use u"[page_name_with_spaces any title]" [list of Unicode strings]

nonexist_qm

0

Default for displaying WantedPages with a question mark, like in the original wiki (changeable by the user)

page_category_regex

ur'(?P<all>Category(?P<key>\S+))'

Pagenames containing a match for this regex are regarded as Wiki categories [Unicode]

page_credits

[...]

list with html fragments with logos or strings for crediting.

page_dict_regex

u'[a-z0-9]Dict$'

Pagenames containing a match for this regex are regarded as containing variable dictionary definitions [Unicode]

page_footer1

""

Custom HTML markup sent before the system footer (see HelpOnSkins)

page_footer2

""

Custom HTML markup sent after the system footer (see HelpOnSkins)

page_front_page

u'HelpOnLanguages'

Name of the front page. We don't expect you to keep the default. Just read HelpOnLanguages in case you're wondering... [Unicode]

page_group_regex

u'[a-z0-9]Group$'

Pagenames containing a match for this regex are regarded as containing group definitions [Unicode]

page_header1

""

Custom HTML markup sent before the system header / title area (see HelpOnSkins)

page_header2

""

Custom HTML markup sent after the system header / title area (see HelpOnSkins)

page_iconbar

["view", ...]

list of icons to show in iconbar, valid values are only those in page_icons_table. Available only in classic theme.

page_icons_table

dict

dict of {'iconname': (url, title, icon-img-key), ...}. Available only in classic theme.

page_license_enabled

0

Show a license hint in page editor.

page_license_page

u'WikiLicense'

Page linked from the license hint. [Unicode]

page_local_spelling_words

u'LocalSpellingWords'

Name of the page containing user-provided spellchecker words [Unicode]

page_template_regex

u'[a-z0-9]Template$'

Pagenames containing a match for this regex are regarded as templates for new pages [Unicode]

refresh

None

refresh = (minimum_delay_s, targets_allowed) enables use of #refresh 5 PageName processing instruction, targets_allowed must be either 'internal' or 'external'

shared_intermap

None

Path to a file containing global InterWiki definitions (or a list of such filenames)

show_hosts

1

Disable this option to hide host names and IPs

show_interwiki

0

Enable this option to let the theme display your interwiki name

show_login

1

Disable this option to get login/logout action removed

show_names

1

Disable this option to hide names from the info view and RecentChanges (this was previously done by show_hosts)

show_section_numbers

0

True to show section numbers in headings by default

show_timings

0

Shows some timing values at bottom of page - used for development

show_version

0

Show MoinMoin's version at the bottom of each page

sitename

u'Untitled Wiki'

Short description of your wiki site, displayed below the logo on each page, and used in RSS documents as the channel title [Unicode]

stylesheets

[]

List of tuples (media, csshref) to insert after theme css, before user css

superuser

[]

List of trusted user names with wiki system administration super powers (not to be confused with ACL admin rights!). Used for e.g. making full backups, software installation, language installation via SystemPagesSetup and more. See also HelpOnPackageInstaller.

theme_default

'modern'

the name of the theme that is used by default (see HelpOnThemes)

theme_force

False

If True, do not allow to change the theme

trail_size

5

Number of pages in the trail of visited pages

tz_offset

0.0

default time zone offset in hours from UTC

ua_spiders

...|google|wget|...

A regex of HTTP_USER_AGENTs that should be excluded from logging

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 icons, css, etc.

unzip_attachments_count

51

the number of files which are extracted from the zip file

unzip_attachments_space

200MB

this total amount of bytes can be used to unzip files.

unzip_single_file_size

2MB

size of a single file in the archive which will be extracted

user_autocreate

False

If set to True user accounts are created automatically (see HelpOnAuthentication).

user_checkbox_defaults

dict

Sets the default settings of the UserPreferences checkboxes. See /UserPreferences or multiconfig.py for the default settings. Example: user_checkbox_defaults = {'edit_on_doubleclick': 0}

user_checkbox_disable

[]

a list of checkbox names to be disabled in the UserPreferences. A disabled checkbox is displayed greyedout and uses the default value set in user_checkbox_defaults.

user_checkbox_fields

[...]

list of checkbox items, see /UserPreferences or multiconfig.py

user_checkbox_remove

[]

a list of checkbox names to be removed from the UserPreferences. A removed checkbox uses the default value set in user_checkbox_defaults. See /UserPreferences

user_email_unique

True

check emails for uniqueness and don't accept duplicates.

user_form_defaults

[]

a list of form defaults for UserPreferences. See /UserPreferences

user_form_disable

[]

a list of form field names to be disabled in the UserPreferences. A disabled field is displayed greyedout and uses the default value set in user_form_defaults. See /UserPreferences

user_form_fields

[...]

list of userprefs form items, see /UserPreferences or multiconfig.py

user_form_remove

[]

a list of form field names to be removed from the UserPreferences. A removed form field uses the default value set in user_form_defaults. See /UserPreferences

user_homewiki

Self

farmconfig: wiki where the user home pages are located (useful if you have many users). You could even link to nonwiki "user pages" if the wiki username is in the target URL.

xmlrpc_putpage_enabled

False

True to enable wikirpc's putPage call writing to the given pagename. When False, it always writes to PutPageTestPage instead of the given pagename.

xmlrpc_putpage_trusted_only

True

Require users using putPage call to be in Trusted group (usually achieved by http auth).

有些值只能在 MoinMoin/config.py 中设置(他们是MoinMoin代码的一部分,因此对所有维基都有影响),- 只有对系统很了解的情况下才可以修改这些值:

charset

'utf-8'

the encoding / character set used by the wiki

lowerletters

ucs-2 lowercase letters

Lowercase letters, used to define what is a WikiName

smileys

{}

user-defined smileys (a dict with the markup as the key and a tuple of width, height, border, image name as the value)

umask

0770

umask used on all open(), mkdir() and similar calls

upperletters

ucs-2 uppercase letters

uppercase letters, used to define what is a WikiName

url_schemas

[]

additional URL schemas you want to have recognized (list of strings; e.g. ['ldap', 'imap'])

特殊选项

Character Set

Moin uses unicode internally, and utf-8 for external output and input, like pages, html output and translation files. The external character set is defined in config.charset to utf-8. This setting is fine for all languages, as any character can be encoded in utf-8. You should not change this value, although technically it is possible.

此页的英文版本:HelpOnConfiguration