3 Medusa

Medusa is a snap to install - simply unpack the medusa distribution. You can place it anywhere. I put it in /home/richard/src/medusa on Unix and C:\web\medusa\ on win95, but it's entirely up to you.

Copy the bobo_handler.py file into the Medusa directory.

Make a backup of the start_medusa.py script. Edit the start_medusa.py script down at the "HTTP Server" section (search for that string). Just after the line hs.install_handler(dh), insert the following lines (depending on operating system):

On UNIX:

sys.path.append("/home/richard/src/bobo/hello")
import bobo_handler
import hello
bfh = bobo_handler.bobo_handler(hello, 
                                uri_base="/cgi-bin/hello", 
                                debug=1)
hs.install_handler(bfh)

On Win95:

sys.path.append("C:\\web\\bobo\\hello")
import bobo_handler
import hello
bfh = bobo_handler.bobo_handler(hello, 
                                uri_base="/cgi-bin/hello", 
                                debug=1)
hs.install_handler(bfh)

I've defined the debug=1 flag so that I can play around with editing the hello.py script without having to restart the Medusa server. If you don't include the flag, then you'll have to kill and restart the server each time you change the source for your application. This has a major benefit in that you can edit and test the source and not affect the running application.

Note that I've specified the URI base in these examples. It's perfectly OK to leave them out -- Medusa's Bobo handler will figure out what the base name should be (in this case, "/hello"). Unfortunately, some of the most popular web browsers do special cache tricks if the URI doesn't start with "/cgi-bin/". It's better to include a "cgi-bin" even if we're lying :)