I needed a lightweight standalone Wiki for tinkering around and writing a few project notes, unfortunately most of the WikiWikiClones needed Apache or IIS, and I wanted something self contained and lite.
So, exactly how lite? 25 lines of Python, I guess that's probably lite enough!
How did I do that? Pretty easily actually, Python's CGIHTTPServer module did all the heavy lifting, Sean Palmer's minimal Wiki WyPy did the WikiMagic, and a minor tweak of the example code for the BaseHTTPServer module (shown below) glues it together:
import BaseHTTPServer
import CGIHTTPServer
def run(server_class=BaseHTTPServer.HTTPServer,
handler_class=CGIHTTPServer.CGIHTTPRequestHandler):
server_address = ('', 8000)
handler_class.cgi_directories = ['']
httpd = server_class(server_address, handler_class)
httpd.serve_forever()
run()
Install instructions: Put the above code (I called my copy MyCgi.py)
and wypy.py in a directory, create a subdirectory named w, run
MyCgi.py and point your browser at http://localhost:8000/wypy.py
Minor niggles so far are that I can't get the 11 line version of WyPy to work so I've had to resort to using the (not very) bloated 18 line version, and that WyPy isn't as fully featured as say MoinMoin. I've also had to change two places in wypy.py that use "wypy" as an href to "wypy.py" as Windows isn't smart enough to autorun Python scripts without a bit of a nudge. I'm looking at the 11 line version, and that should be fixable, plus as I'm considering using this same Wiki setup on various devices including my Psion 5mx and hopefully my N-Gage (when Nokia finally release their Python port), featherweight code is a good thing!