MiniHOWTO deploy MoinMoin in Jumpline

python moinmoin

MoinMoin immediately jumps to my mind when I consider to deploy a Wiki for drafting. The official Wiki hosts a very complete HOWTO using Apache and mod_python. However, this HOWTO is based upon another basic installation and WikiInstanceCreation. Well, I must admit that patience is a cherished virtue that I am lacking, so I jumped to the mod_python, and hope this MiniHOWTO could save some time for other impatient developers as well:

Boilerplate

Install MoinMoin, setup the mod_python and configure the virtual host(wiki.kunxi.org in my case).

Prepare the data

For the sake of security and easy maintain, the code residents in /var/www/moin, and the data is stored in /var/www/wiki. So we need to copy the data from the Moin’s share directory:

cp -R /usr/local/share/moin/data /var/www/wiki
cp -R /usr/local/share/moin/underlay /var/www/wiki
cp /usr/local/share/moin/wikiconfig.py /var/www/moin

Modify data_dir and data_underlay_dir in wikiconfig.py to reflect the change; and set the url_prefix as `/wiki_

Configure the mod_python

It is time to glue departed pieces in httpd.conf:

<VirtualHost *:80>
    ServerName wiki.kunxi.org
    DocumentRoot /var/www/moin
    SetHandler python-program
    PythonPath "['/var/www/moin'] + sys.path"
    PythonHandler MoinMoin.request::RequestModPy.run
    PythonDebug Off

    # Rewrite urls
    RewriteEngine On
    RewriteLogLevel 0
    # map /wiki static files to Moin htdocs
    RewriteRule ^/wiki/(.*)$ /usr/local/share/moin/htdocs/$1 [last]
    # map everything else to server script
    RewriteRule ^(.*)$ /var/www/moin/moinmodpy.py$1
    <Location "/wiki">
        SetHandler None
    </Location>
</VirtualHost>

First, we setup MoinMoin’s modpy.py handler to handle the virtual host, wiki.kunxi.org; then set the alias /wiki to the moin’s shared doc, and disable the mod_python handler there. Done.