I have the following minimum code for a CGI processing HTTP server, obtained from several examples on inner pipes:
#!/usr/bin/env python import BaseHTTPServer import CGIHTTPServer import cgitb; cgitb.enable() # Error reporting server = BaseHTTPServer.HTTPServer handler = CGIHTTPServer.CGIHTTPRequestHandler server_address = ("", 8000) handler.cgi_directories = [""] httpd = server(server_address, handler) httpd.serve_forever()
However, when I execute the script and try to run the test script in the same directory via CGI using http://localhost:8000/test.py , I see the text of the script, not the results of the execution.
Permissions are set correctly, and the test script itself is not a problem (since I can run it using python -m CGIHTTPServer when the script is in cgi-bin). I suspect the problem has something to do with the default CGI directories.
How can i execute the script?
source share