求助:我参照书上写了一个很简单的CGIServer.py 可以访问改目录下得html但就是不能访问cgi,这是怎么回事呢?
代码如下(CGIServer.py):
# coding=gb2312import BaseHTTPServer,CGIHTTPServerfrom BaseHTTPServer import HTTPServerfrom CGIHTTPServer import CGIHTTPRequestHandler
def run(server_class=HTTPServer, handler_class=CGIHTTPRequestHandler): server_address=('',8001) httpd=server_class(server_address, handler_class) httpd.serve_forever() if __name__ == '__main__': run()
(hello.cgi):
#!d:\Python27\python.exe
print("Content-type: text/plain\n")print("Hello, World!")
代码如下(CGIServer.py):
# coding=gb2312import BaseHTTPServer,CGIHTTPServerfrom BaseHTTPServer import HTTPServerfrom CGIHTTPServer import CGIHTTPRequestHandler
def run(server_class=HTTPServer, handler_class=CGIHTTPRequestHandler): server_address=('',8001) httpd=server_class(server_address, handler_class) httpd.serve_forever() if __name__ == '__main__': run()
(hello.cgi):
#!d:\Python27\python.exe
print("Content-type: text/plain\n")print("Hello, World!")



