changeset 4624:fb5abe50c6d2

wikiconfig/farmconfig: improve values for data(_underlay)_dir, make logo work automatically, fix wiki regex samples in farmconfig
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 01 Mar 2009 21:57:08 +0100
parents 16ee781ef3ad
children 1c60c378eb1a
files wiki/config/wikiconfig.py wiki/config/wikifarm/farmconfig.py wikiconfig.py
diffstat 3 files changed, 72 insertions(+), 70 deletions(-) [+]
line wrap: on
line diff
--- a/wiki/config/wikiconfig.py	Sun Mar 01 19:22:59 2009 +0100
+++ b/wiki/config/wikiconfig.py	Sun Mar 01 21:57:08 2009 +0100
@@ -25,10 +25,42 @@
     from the wikifarm directory instead! **
 """
 
-from MoinMoin.config.multiconfig import DefaultConfig
+import os
+
+from MoinMoin.config import multiconfig, url_prefix_static
 
 
-class Config(DefaultConfig):
+class Config(multiconfig.DefaultConfig):
+
+    # Critical setup  ---------------------------------------------------
+
+    # Directory containing THIS wikiconfig:
+    wikiconfig_dir = os.path.abspath(os.path.dirname(__file__))
+
+    # We assume that this config file is located in the instance directory, like:
+    # instance_dir/
+    #              wikiconfig.py
+    #              data/
+    #              underlay/
+    # If that's not true, feel free to just set instance_dir to the real path
+    # where data/ and underlay/ is located:
+    #instance_dir = '/where/ever/your/instance/is'
+    instance_dir = wikiconfig_dir
+
+    # Where your own wiki pages are (make regular backups of this directory):
+    data_dir = os.path.join(instance_dir, 'data', '') # path with trailing /
+
+    # Where system and help pages are (you may exclude this from backup):
+    data_underlay_dir = os.path.join(instance_dir, 'underlay', '') # path with trailing /
+
+    # The URL prefix we use to access the static stuff (img, css, js).
+    # Note: moin runs a static file server at url_prefix_static path (relative
+    # to the script url).
+    # If you run your wiki script at the root of your site (/), just do NOT
+    # use this setting and it will automatically work.
+    # If you run your wiki script at /mywiki, you need to use this:
+    #url_prefix_static = '/mywiki' + url_prefix_static
+
 
     # Wiki identity ----------------------------------------------------
 
@@ -38,7 +70,7 @@
     # Wiki logo. You can use an image, text or both. [Unicode]
     # For no logo or text, use '' - the default is to show the sitename.
     # See also url_prefix setting below!
-    logo_string = u'<img src="/moin_static190/common/moinmoin.png" alt="MoinMoin Logo">'
+    logo_string = u'<img src="%s/common/moinmoin.png" alt="MoinMoin Logo">' % url_prefix_static
 
     # name of entry page / front page [Unicode], choose one of those:
 
@@ -55,35 +87,6 @@
     #show_interwiki = 1
 
 
-    # Critical setup  ---------------------------------------------------
-
-    # Misconfiguration here will render your wiki unusable. Check that
-    # all directories are accessible by the web server or moin server.
-
-    # If you encounter problems, try to set data_dir and data_underlay_dir
-    # to absolute paths.
-
-    # Where your mutable wiki pages are. You want to make regular
-    # backups of this directory.
-    data_dir = './data/'
-
-    # Where read-only system and help page are. You might want to share
-    # this directory between several wikis. When you update MoinMoin,
-    # you can safely replace the underlay directory with a new one. This
-    # directory is part of MoinMoin distribution, you don't have to
-    # backup it.
-    data_underlay_dir = './underlay/'
-
-    # The URL prefix we use to access the static stuff (img, css, js).
-    # NOT touching this is maybe the best way to handle this setting as moin
-    # uses a good internal default (something like '/moin_static190' for moin
-    # version 1.9.0).
-    # For Twisted and standalone server, the default will automatically work.
-    # For others, you should make a matching server config (e.g. an Apache
-    # Alias definition pointing to the directory with the static stuff).
-    #url_prefix_static = '/moin_static190'
-
-
     # Security ----------------------------------------------------------
 
     # This is checked by some rather critical and potentially harmful actions,
--- a/wiki/config/wikifarm/farmconfig.py	Sun Mar 01 19:22:59 2009 +0100
+++ b/wiki/config/wikifarm/farmconfig.py	Sun Mar 01 21:57:08 2009 +0100
@@ -40,16 +40,14 @@
 #  * in the right part, "^" means "beginning" and "$" means "end"
 
 wikis = [
-    # Standalone server needs the port e.g. localhost:8000
-    # Twisted server can now use the port, too.
 
-    # wikiname,     url regular expression (no protocol)
+    # wikiname, url regular expression
     # ---------------------------------------------------------------
     ("mywiki", r".*"),   # this is ok for a single wiki
 
     # for multiple wikis, do something like this:
-    #("moinmoin",    r"^moinmo.in/.*$"),
-    #("moinmaster",  r"^master.moinmo.in/.*$"),
+    #("wiki1", r"^http://wiki1\.example\.org/.*$"),
+    #("wiki2", r"^http://wiki2\.example\.org/.*$"),
 ]
 
 
@@ -65,41 +63,24 @@
 # this is to get everything to sane defaults, so we need to change only what
 # we like to have different:
 
-from MoinMoin.config.multiconfig import DefaultConfig
+from MoinMoin.config import multiconfig, url_prefix_static
 
 # Now we subclass this DefaultConfig. This means that we inherit every setting
 # from the DefaultConfig, except those we explicitely define different.
 
-class FarmConfig(DefaultConfig):
+class FarmConfig(multiconfig.DefaultConfig):
 
     # Critical setup  ---------------------------------------------------
 
-    # Misconfiguration here will render your wiki unusable. Check that
-    # all directories are accessible by the web server or moin server.
-
-    # If you encounter problems, try to set data_dir and data_underlay_dir
-    # to absolute paths.
-
-    # Where your mutable wiki pages are. You want to make regular
-    # backups of this directory.
-    data_dir = './data/'
-
-    # Where read-only system and help page are. You might want to share
-    # this directory between several wikis. When you update MoinMoin,
-    # you can safely replace the underlay directory with a new one. This
-    # directory is part of MoinMoin distribution, you don't have to
-    # backup it.
-    data_underlay_dir = './underlay/'
-
     # The URL prefix we use to access the static stuff (img, css, js).
-    # NOT touching this is maybe the best way to handle this setting as moin
-    # uses a good internal default (something like '/moin_static190' for moin
-    # version 1.9.0).
-    # For Twisted and standalone server, the default will automatically work.
-    # For others, you should make a matching server config (e.g. an Apache
-    # Alias definition pointing to the directory with the static stuff).
-    #url_prefix_static = '/moin_static190'
-
+    # Note: moin runs a static file server at url_prefix_static path (relative
+    # to the script url).
+    # If you run your wiki script at the root of your site (/), just do NOT
+    # use this setting and it will automatically work.
+    # If you run your wiki script at /mywiki, you need to use this:
+    #url_prefix_static = '/mywiki' + url_prefix_static
+    # If you need different url_prefix_static setups for your wikis,
+    # you'll have to do it in each wiki's config.
 
     # Security ----------------------------------------------------------
 
--- a/wikiconfig.py	Sun Mar 01 19:22:59 2009 +0100
+++ b/wikiconfig.py	Sun Mar 01 21:57:08 2009 +0100
@@ -5,21 +5,38 @@
 
 This is NOT intended for internet or server or multiuser use due to relaxed security settings!
 """
+
 import sys, os
-from MoinMoin.config.multiconfig import DefaultConfig
+
+from MoinMoin.config import multiconfig, url_prefix_static
 
 
-class LocalConfig(DefaultConfig):
+class LocalConfig(multiconfig.DefaultConfig):
     # vvv DON'T TOUCH THIS EXCEPT IF YOU KNOW WHAT YOU DO vvv
-    moinmoin_dir = os.path.abspath(os.path.normpath(os.path.dirname(sys.argv[0])))
-    data_dir = os.path.join(moinmoin_dir, 'wiki', 'data')
-    data_underlay_dir = os.path.join(moinmoin_dir, 'wiki', 'underlay')
+    # Directory containing THIS wikiconfig:
+    wikiconfig_dir = os.path.abspath(os.path.dirname(__file__))
+
+    # We assume this structure for a simple "unpack and run" scenario:
+    # wikiconfig.py
+    # wiki/
+    #      data/
+    #      underlay/
+    # If that's not true, feel free to just set instance_dir to the real path
+    # where data/ and underlay/ is located:
+    #instance_dir = '/where/ever/your/instance/is'
+    instance_dir = os.path.join(wikiconfig_dir, 'wiki')
+
+    # Where your own wiki pages are (make regular backups of this directory):
+    data_dir = os.path.join(instance_dir, 'data', '') # path with trailing /
+
+    # Where system and help pages are (you may exclude this from backup):
+    data_underlay_dir = os.path.join(instance_dir, 'underlay', '') # path with trailing /
 
     DesktopEdition = True # give all local users full powers
     acl_rights_default = u"All:read,write,delete,revert,admin"
     surge_action_limits = None # no surge protection
     sitename = u'MoinMoin DesktopEdition'
-    logo_string = u'<img src="/moin_static190/common/moinmoin.png" alt="MoinMoin Logo">'
+    logo_string = u'<img src="%s/common/moinmoin.png" alt="MoinMoin Logo">' % url_prefix_static
     page_front_page = u'FrontPage' # change to some better value
     # ^^^ DON'T TOUCH THIS EXCEPT IF YOU KNOW WHAT YOU DO ^^^
 
@@ -43,3 +60,4 @@
     if not str(err).endswith('wikiconfig_local'):
         raise
     Config = LocalConfig
+