annotate wikiserverconfig.py @ 4960:2a024d3e418f

simplify wikiserver configuration by using same names as werkzeug's run_simple wikiserverconfig changes: use hostname=... now (not interface=... any more) using --interface for the moin server standalone command still works (--hostname is also supported) we can add options/arguments for werkzeug's run_simple and our own run_server now easily, just the option name needs to be listed in the kwargs processing. stuff not explicitely declared as param in run_server will get passed through to run_simple via **kw made DefaultConfig a new style class removed unsupported options (leftovers from pre-WSGI standalone server)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 25 Aug 2009 18:46:40 +0200
parents 7000bf88e348
children 5b262b81c236
rev   line source
3495
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 """
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 Standalone server configuration, you can either use this file or
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 commandline options to configure server options.
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4 """
4605
edb6cb2cac43 Environment variable MOIN_DEBUGGER=True will enable werkzeug's debugger for the standalone wikiserver
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3495
diff changeset
5 import os
3495
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
6
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 from MoinMoin.script.server.standalone import DefaultConfig
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8
4618
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
9 class LocalConfig(DefaultConfig):
4960
2a024d3e418f simplify wikiserver configuration by using same names as werkzeug's run_simple
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4621
diff changeset
10 # hostname or IP the server listens on
2a024d3e418f simplify wikiserver configuration by using same names as werkzeug's run_simple
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4621
diff changeset
11 # use '' for all interfaces
2a024d3e418f simplify wikiserver configuration by using same names as werkzeug's run_simple
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4621
diff changeset
12 # or "1.2.3.4" for some specific IP
2a024d3e418f simplify wikiserver configuration by using same names as werkzeug's run_simple
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4621
diff changeset
13 #hostname = 'localhost'
2a024d3e418f simplify wikiserver configuration by using same names as werkzeug's run_simple
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4621
diff changeset
14
2a024d3e418f simplify wikiserver configuration by using same names as werkzeug's run_simple
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4621
diff changeset
15 # if you use port < 1024, you need to start as root
2a024d3e418f simplify wikiserver configuration by using same names as werkzeug's run_simple
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4621
diff changeset
16 #port = 8080
3495
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 # if you start the server as root, the standalone server can change
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
19 # to this user and group, e.g. 'www-data'
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
20 #user = ''
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21 #group = ''
be29346a6aa3 add wikiserverconfig sample for the standalone server configuration
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
22
4621
7000bf88e348 MOIN_DEBUGGER=off/web/external
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4618
diff changeset
23 # How to debug? Your options:
7000bf88e348 MOIN_DEBUGGER=off/web/external
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4618
diff changeset
24 # debug = 'off' # for production wikis, exceptions are logged
7000bf88e348 MOIN_DEBUGGER=off/web/external
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4618
diff changeset
25 # debug = 'web' # show traceback in the browser, offer debug console,
7000bf88e348 MOIN_DEBUGGER=off/web/external
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4618
diff changeset
26 # # this makes use of a built-in debugger (werkzeug.debug)
7000bf88e348 MOIN_DEBUGGER=off/web/external
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4618
diff changeset
27 # debug = 'external' # don't catch Exceptions, so some external debugger gets them
7000bf88e348 MOIN_DEBUGGER=off/web/external
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4618
diff changeset
28 # CAUTION: Do not use anything but 'off' for production environments as it
7000bf88e348 MOIN_DEBUGGER=off/web/external
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4618
diff changeset
29 # might disclose sensitive informations and even enable doing evil
7000bf88e348 MOIN_DEBUGGER=off/web/external
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4618
diff changeset
30 # things from some debugger's web interface!
4605
edb6cb2cac43 Environment variable MOIN_DEBUGGER=True will enable werkzeug's debugger for the standalone wikiserver
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3495
diff changeset
31 # For convenience, the default behaviour (see below) is to read the
4621
7000bf88e348 MOIN_DEBUGGER=off/web/external
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4618
diff changeset
32 # environment variable MOIN_DEBUGGER. If not set, it means the same as 'off'.
7000bf88e348 MOIN_DEBUGGER=off/web/external
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4618
diff changeset
33 debug = os.environ.get('MOIN_DEBUGGER', 'off')
4605
edb6cb2cac43 Environment variable MOIN_DEBUGGER=True will enable werkzeug's debugger for the standalone wikiserver
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 3495
diff changeset
34
4960
2a024d3e418f simplify wikiserver configuration by using same names as werkzeug's run_simple
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4621
diff changeset
35
4618
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
36 # DEVELOPERS! Do not add your configuration items there,
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
37 # you could accidentally commit them! Instead, create a
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
38 # wikiserverconfig_local.py file containing this:
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
39 #
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
40 # from wikiserverconfig import LocalConfig
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
41 #
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
42 # class Config(LocalConfig):
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
43 # configuration_item_1 = 'value1'
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
44 #
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
45
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
46 try:
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
47 from wikiserverconfig_local import Config
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
48 except ImportError, err:
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
49 if not str(err).endswith('wikiserverconfig_local'):
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
50 raise
0e7c007f8ed9 handle wikiserverconfig(_local) in the same way as wikiconfig(_local) (thanks to Raphael Bossek for the patch)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4613
diff changeset
51 Config = LocalConfig