2013-04-29 97 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 = ['']

相關問題