Source

moin2 / wikiconfig.py

Full commit
Thomas Waldmann 5568cf1 













marchael 78a2962 
Thomas Waldmann 5568cf1 









marchael dc04953 
marchael fd28cf7 
Thomas Waldmann 5568cf1 









Thomas Waldmann 8cc7240 
Thomas Waldmann 5568cf1 











Thomas Waldmann 902378b 



Thomas Waldmann 5568cf1 




Thomas Waldmann b7fda72 
Thomas Waldmann 5568cf1 
Thomas Waldmann 2652fa7 
Thomas Waldmann 5568cf1 

Thomas Waldmann d1b8dc0 

Thomas Waldmann 865c378 
Akash Sinha 85c3759 
Thomas Waldmann 865c378 




Reimar Bauer d28a343 
Thomas Waldmann 5568cf1 




















Thomas Waldmann c9684bc 




Thomas Waldmann 5568cf1 






# -*- coding: utf-8 -*-
"""MoinMoin Wiki - Configuration"""

import sys, os

from MoinMoin.config.default import DefaultConfig
from MoinMoin.storage.backends import create_simple_mapping
from MoinMoin.util.interwiki import InterWikiMap


class Config(DefaultConfig):
    # vvv DON'T TOUCH THIS EXCEPT IF YOU KNOW WHAT YOU DO vvv
    # Directory containing THIS wikiconfig:
    wikiconfig_dir = os.path.abspath(os.path.dirname(__file__))
    interwikiname = u'MoinMoin2'
    # We assume this structure for a simple "unpack and run" scenario:
    # wikiconfig.py
    # wiki/
    #      data/
    # contrib/
    #      xml/
    #          preloaded_items.xml
    # If that's not true, feel free to adjust the pathes.
    instance_dir = os.path.join(wikiconfig_dir, 'wiki')
    data_dir = os.path.join(instance_dir, 'data') # Note: this used to have a trailing / in the past
    index_dir = os.path.join(instance_dir, "index")
    index_dir_tmp = os.path.join(instance_dir, "index_tmp")
    # This puts the contents from the specified xml file (a serialized backend) into your
    # backend(s). You can remove this after the first request to your wiki or
    # from the beginning if you don't want to use this feature at all.
    load_xml = os.path.join(wikiconfig_dir, 'contrib', 'xml', 'preloaded_items.xml')
    #save_xml = os.path.join(wikiconfig_dir, 'contrib', 'xml', 'saved_items.xml')

    # This provides a simple default setup for your backend configuration.
    # 'fs:' indicates that you want to use the filesystem backend. You can also use
    # 'hg:' instead to indicate that you want to use the mercurial backend.
    # Alternatively you can set up the mapping yourself (see HelpOnStorageConfiguration).
    namespace_mapping = create_simple_mapping(
                            backend_uri='fs2:%s/%%(nsname)s' % data_dir,
                            # XXX we use rather relaxed ACLs for the development wiki:
                            content_acl=dict(before=u'',
                                             default=u'All:read,write,create,destroy,admin',
                                             after=u'', ),
                            user_profile_acl=dict(before=u'',
                                             default=u'All:read,write,create,destroy,admin',
                                             after=u'', ),
                            )

    # Load the interwiki map from intermap.txt:
    interwiki_map = InterWikiMap.from_file(os.path.join(wikiconfig_dir, 'contrib', 'interwiki', 'intermap.txt')).iwmap
    # we must add entries for 'Self' and our interwikiname:
    #interwikiname = 'MyInterWikiName'
    #interwiki_map[interwikiname] = 'http://localhost:8080/'
    interwiki_map['Self'] = 'http://localhost:8080/'

    sitename = u'My MoinMoin'

    # for now we load some 3rd party stuff from the place within moin where it is currently located,
    # but soon we'll get rid of this stuff:
    env_dir = 'env'
    serve_files = dict(
        docs = os.path.join(wikiconfig_dir, 'docs', '_build', 'html'),
    )

    # we slowly migrate all stuff from above (old) method, to xstatic (new) method,
    # see https://bitbucket.org/thomaswaldmann/xstatic for details:
    from xstatic.main import XStatic
    mod_names = ['jquery', 'jquery_file_upload', 'ckeditor', 'svgweb', 'svgedit_moin', 'twikidraw_moin', 'anywikidraw', 'mathjax', 'jquery_multi_download', ]
    pkg = __import__('xstatic.pkg', fromlist=mod_names)
    for mod_name in mod_names:
        mod = getattr(pkg, mod_name)
        xs = XStatic(mod, root_url='/static', provider='local', protocol='http')
        serve_files.update([(xs.name, xs.base_dir)])

    # ^^^ DON'T TOUCH THIS EXCEPT IF YOU KNOW WHAT YOU DO ^^^

    #item_root = u'Home' # change to some better value


MOINCFG = Config # Flask only likes uppercase stuff
# Flask settings - see the flask documentation about their meaning
SECRET_KEY = 'you need to change this so it is really secret'
#DEBUG = False # use True for development only, not for public sites!
#TESTING = False
#SESSION_COOKIE_NAME = 'session'
#PERMANENT_SESSION_LIFETIME = timedelta(days=31)
#USE_X_SENDFILE = False
#LOGGER_NAME = 'MoinMoin'
#config for flask-cache:
#CACHE_TYPE = 'filesystem'
#CACHE_DIR = '/path/to/flask-cache-dir'

# DEVELOPERS! Do not add your configuration items here - you could accidentally
# commit them! Instead, create a wikiconfig_local.py file containing this:
#
#from wikiconfig_editme import *
#
# In wikiconfig_editme.py (the indirection is needed so that the auto reload
# mechanism of the builtin server works) you do this:
#
#from wikiconfig import *
#
#class LocalConfig(Config):
#    configuration_item_1 = 'value1'
#
#MOINCFG = LocalConfig
#DEBUG = True