python2的cgi程序

python2的cgi程序

CGIHTTPServer 是 Python 标准模块中的 Web 服务器,它可以运行 CGI 程序。
用 CGIHTTPServer 运行 CGI 程序时,待运行文件必须位于 cgi-bin 目录下:mkdir cgi-bin
将 python文件放进去:mv hello.py cgi-bin/
赋予文件运行权限:chmod u+x cgi-bin/hello.py
配置好 CGI 程序之后,用 python命令的 -m 选项运行 CGIHTTPServer 了:python2 -m CGIHTTPServer 8080(端口号)
Web 浏览器访问 http://127.0.0.1:8080/cgi-bin/hello.py

猜你喜欢

转载自www.cnblogs.com/Wang-Y/p/9277418.html