python写了一个CGI脚本,为什么从网页看到的是脚本的内容
发布网友
发布时间:2022-04-18 07:44
我来回答
共1个回答
热心网友
时间:2022-04-18 09:14
默认情况下,文件需要放在'/cgi-bin' 或 '/htbin'目录下,才会被解释执行,官方说法如下:
The do_GET() and do_HEAD() functions are modified to run CGI scripts
and serve the output, instead of serving files, if the request leads to
somewhere below the cgi_directories path.
The CGIHTTPRequestHandler defines the following data member:
cgi_directories
This defaults to ['/cgi-bin', '/htbin'] and describes directories to
treat as containing CGI scripts.