Using MoinMoin on your personal webpage

For installing MoinMoin on your personal homepage we created a small helper script called moinmoin-create-1.9.3. Simply run it and configure the installation interactively.

Updating Moin to 1.9.x

For every upgrade, some small changes have to be done. From 1.8.x to 1.9.x there are some new lines and syntax changes in moinmoin/ Make it look like this:

import os
from MoinMoin.config import multiconfig, url_prefix_static
class Config(multiconfig.DefaultConfig):
   wikiconfig_dir = os.path.abspath(os.path.dirname(__file__))
   instance_dir = wikiconfig_dir
   data_dir = os.path.join(instance_dir, 'data', '')
   data_underlay_dir = os.path.join(instance_dir, 'underlay', '')

The moin.fcgi file also has to be replaced with the following content:

import sys, os

# a1) Path of the directory where the MoinMoin code package is located.
#     Needed if you installed with --prefix=PREFIX or you didn't use
sys.path.insert(0, '/usr/pack/moinmoin-1.9.x-hp/lib/python')

# a2) Path of the directory where / is located.
#     See wiki/config/... for some sample config files.
sys.path.insert(0, '/home/wikiuser/moinmoin')

# b) Configuration of moin's logging
#    If you have set up MOINLOGGINGCONF environment variable, you don't need this!
#    You also don't need this if you are happy with the builtin defaults.
#    See wiki/config/logging/... for some sample config files.
#logging = log.getLogger(__name__)
from MoinMoin import log

# Creating the WSGI application
# use shared=True to have moin serve the builtin static docs
# use shared=False to not have moin serve static docs
# use shared='/my/path/to/htdocs' to serve static docs from that path
from MoinMoin.web.serving import make_application
app = make_application(shared=True)  # <-- adapt here as needed

# Is fixing the script name needed?
# Use None if your url looks like http://domain/wiki/moin.fcgi
# Use '' if you use rewriting to run at http://domain/
# Use '/mywiki' if you use rewriting to run at http://domain/mywiki/
fix_script_name = None  # <-- adapt here as needed

if fix_script_name is None:
    application = app
    def script_name_fixer(env, start):
        env['SCRIPT_NAME'] = fix_script_name
        return app(env, start)
    application = script_name_fixer

# CGI with Apache2 on Windows (maybe other combinations also) has trouble with
# URLs of non-ASCII pagenames. Use True to enable middleware that tries to fix.
fix_apache_win32 = False  # <-- adapt here as needed

if fix_apache_win32:
    from werkzeug.contrib.fixers import PathInfoFromRequestUriFix
    application = PathInfoFromRequestUriFix(application)

## Choose your server mode (threaded, forking or single-thread)
    # v-- adapt here as needed
    from flup.server.fcgi import WSGIServer
#    from flup.server.fcgi_fork import WSGIServer
#    from flup.server.fcgi_single import WSGIServer
except ImportError:
    logging.warning("No flup-package installed, only basic CGI support is available.")
    from MoinMoin.web._fallback_cgi import WSGIServer


Finally we have to delete the cache files:

rm -rf /data/pages/*/cache/*
rm -rf /data/cache

Restart (kill) the moin.fcgi process and

Congratulations! You just upgraded to moinmoin-1.9.x


Web/Homepage/MoinMoin (last edited 2020-09-01 09:51:09 by pmeier)