Please read before continuing
- These instructions are for WikklyText 1.9.x. If you are running an earlier version, see BehindApache instead.
- If you are upgrading from WikklyText 1.6.x or earlier, you can delete the file wikboot.py in your wiki folder. It is no longer used.
This recipe shows how to setup a wiki using Apache and mod_python.
For this example, I'll assume you are using the following locations. Adjust as needed:
- Wiki filesystem location
- /var/www/wikis/mywiki
- Public URL
- http://example.com/my/wiki
Create wiki
You can copy an existing wiki to
/var/www/wikis/mywiki, but for this example I'll just create a new one:
mkdir -p /var/www/wikis/mywiki
cd /var/www/wikis/mywiki
wik init
Select the type of storage you want and accept the rest of the defaults. (
The server options have nothing to do with your Apache setup so its safe to accept the defaults.)
On (at least) Unix/Linux systems, the wiki needs to be owned by the userid that runs the Apache process. For example, on my server the Apache process is owned by
www-user, so I do:
chown -R www-user /var/www/wikis/mywiki
Add server script
Create a Python script in your wiki folder:
/var/www/wikis/mywiki/wiki.py
import os
import wikklytext.wiki.frontend.ws_modpy as ws_modpy
# Assuming this script is placed in your wiki root directory, you
# can leave this as is. Otherwise, set it to the full path of your
# wiki folder.
WIKIPATH = os.path.split(os.path.abspath(__file__))[0]
# Set this to your public URL path
SCRIPT_NAME = "/my/wiki"
# set True to enable logging
USE_LOGGING = False
ws_modpy.init(WIKIPATH, USE_LOGGING)
def handler(req):
return ws_modpy.serve_wiki(WIKIPATH, req, SCRIPT_NAME)
Configure Apache
Edit your Apache configuration (i.e.
httpd.conf,
.htaccess, etc.) to setup mod_python to serve the wiki:
# set this to your public URL path
<Location /my/wiki>
SetHandler mod_python
PythonPath "sys.path + ['/var/www/wikis/mywiki']"
PythonHandler wiki::handler
PythonDebug On
# give a unique name to avoid problems
PythonInterpreter WikiTestModpy
</Location>
Ready to go!
You should now be able to browse to
http://example.com/my/wiki and see your wiki.