2013-04-29 96 views
0

我有以下脚本作为我的CGI服务器:Python的CGIServer不重定向到index.html的

import BaseHTTPServer 
import CGIHTTPServer 
import cgitb; cgitb.enable() ## This line enables CGI error reporting 

server = BaseHTTPServer.HTTPServer 
handler = CGIHTTPServer.CGIHTTPRequestHandler 
server_address = ("", 8600) 
handler.cgi_directories = [''] 

httpd = server(server_address, handler) 
httpd.serve_forever() 

,我有一个文件名为“index.html的”,这被链接到“main.cgi “运行服务器的目录内的可执行文件。但是,它似乎并没有工作。

回答

2

基于我见过你可以试试这个其他的例子:在你的代码

handler.cgi_directories = ["/"] 

,而不是handler.cgi_directories = ['']

相关问题