Ben*_*ey4 22 python hosting cgi simplehttpserver
当我运行python -m SimpleHTTPServer 8000
或python -m CGIHTTPServer 8000
在我的shell中时,我将当前目录的内容托管到互联网上.
我想在浏览时使用命令行中的上述命令使以下cgi_script.py正常工作 192.xxx.x.xx:8000/cgi_script.py
#!/usr/bin/env python
print "Content-Type: text/html"
print
print """\
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
"""
Run Code Online (Sandbox Code Playgroud)
但这个脚本按字面显示,而不仅仅是"Hello World!" 部分.顺便说一句,我将文件权限更改为755 cgi_script.py以及我托管它的文件夹.
rod*_*igo 33
试试吧python -m CGIHTTPServer 8000
.
请注意,您必须将脚本移动到cgi-bin
或htbin
目录才能运行.
归档时间: |
|
查看次数: |
25710 次 |
最近记录: |