I'm not at all knowledgeable about this, so please bear with me. I'm trying to set up python's CGIHTTPServer on OSX to be able to serve cgi-scripts locally, but I seem to be unable to do this.
I've got a simple test script:
#!/usr/bin/env python import cgi cgi.test()
-rwxr-xr-x@ that's located in
~/WWW (with permissions `drwxr-xr-x) that runs just fine from the shell and I have this script to serve them using CGIHTTPServer:
import CGIHTTPServer import BaseHTTPServer class Handler(CGIHTTPServer.CGIHTTPRequestHandler): cgi_directories = ["~/WWW"] PORT = 8000 httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler) print "serving at port", PORT
but when I run it, going to
localhost:8000 just serves the content of the script, not the result (i.e. it gives back the code, not the output).
What am I doing wrong?