- Install mod_python
- Set up a wiki instance
Edit wikiconfig.py
Changes to Apache httpd.conf
- Restart Apache
The sample configurations below are for a wiki instance called mywiki installed in a directory /var/www/moin/mywiki with the main MoinMoin installation installed in python's default site library path. The wiki appears as URL /mywiki under the server - ie http://my.ser.ver/mywiki. You will need to change these to reflect your installation.
Install mod_python
Most people will just add a mod_python package to their current operating system installation. If you are building from source then you should consult the mod_python documentation.
The mod_python installation should have added some lines to the Apache configuration file - either in the file itself or in an included configuration file (for example on Red Hat or Fedora linux the mod_python configuration is in /etc/httpd/conf.d/python.conf).
Make sure you have this line in httpd.conf or mod_python will not work:
LoadModule python_module modules/mod_python.so
After this restart Apache and make sure that it starts successfully, and that the error log has a line similar to this:-
[Sat Jan 01 15:40:49 2005] [notice] mod_python: Creating 4 session mutexes based on 150 max processes and 0 max threads.
You may need to change some environment variables on (eg) FreeBSD - this is detailed in the port installation message.
Set up a wiki instance
This is done as shown in WikiInstanceCreation. Its recommended to first configure the wiki with cgi and check that it works, then change the configuratin to use mod_python. This allows you be sure that any problems are in the mod_python transition rather than the basic MoinMoin installation.
- Copy moin.cgi into your wiki directory
Configure httpd.conf as cgi first (the shown Alias is for moin version 1.6.0):
Alias /moin_static160/ "/usr/share/moin/htdocs/" ScriptAlias /mywiki "/var/www/moin/mywiki/moin.cgi"
Restart Apache and make test that your wiki works.
Edit `wikiconfig.py`
Make sure you use only absolute paths - relative paths will not work!
data_dir = '/var/www/moin/mywiki/data/' data_underlay_dir = '/var/www/moin/mywiki/underlay/'
If you do not want to use absolute paths, you can use Python's os module to construct the relative paths: {{{import os data_dir = os.path.join(os.path.dirname(file), 'data/') data_underlay_dir = os.path.join(os.path.dirname(file), 'underlay/') }}}
Test that the wiki works after this change.
Changes to Apache `httpd.conf`
After your wiki is running as cgi script, convert it to run with mod_python.
If you run your wiki as cgi as we recommended before, remove or comment the ScriptAlias directive:
#ScriptAlias /mywiki "/var/www/moin/mywiki/moin.cgi"
Add a Location directive:
<Location /mywiki> SetHandler python-program # Add the path of your wiki directory PythonPath "['/var/www/moin/mywiki'] + sys.path" PythonHandler MoinMoin.request.request_modpython::Request.run </Location>
If you have multiple MoinMoin instances then add one location directive for each one (changing the paths as appropriate) and add a line with the directive PythonInterpreter mywiki to each Location section. With this directive different subinterpreters with completely separate namespaces will be used for each wiki (see here for details).
If you did not install MoinMoin in the default location, you will have to add the path to MoinMoin to the system path:
PythonPath "['/var/www/moin/mywiki', '/prefix/lib/python2.x/site-packages'] + sys.path"
Restart Apache - everything should now work correctly.