4
我想在Mac OS X上设置Python的CGIHTTPServer
以便能够在本地提供CGI脚本,但我似乎无法执行此操作。在Mac OS X上使用CGIHTTPServer服务Python脚本
我有一个简单的测试脚本:
#!/usr/bin/env python
import cgi
cgi.test()
它有权限[email protected]
,位于~/WWW
(与权限drwxr-xr-x
)。它运行从shell就好了,我有这个脚本使用CGIHTTPServer
为他们服务:
import CGIHTTPServer
import BaseHTTPServer
class Handler(CGIHTTPServer.CGIHTTPRequestHandler):
cgi_directories = ["~/WWW"]
PORT = 8000
httpd = BaseHTTPServer.HTTPServer(("", PORT), Handler)
print "serving at port", PORT
但是当我运行它,去localhost:8000
仅仅是为脚本,而不是结果的内容(即它给回代码,而不是输出)。
我在做什么错?
是的!做到了!谢谢! – thepandaatemyface 2010-08-07 21:09:34