所以我在我的服务器上安装了 python,并且我将 wsgi_module 与 apache 一起使用。
我所有的python程序都必须使用这种格式吗:
def application(environ, start_response):
headers = []
headers.append(('Content-Type', 'text/plain'))
write = start_response('200 OK', headers)
input = environ['wsgi.input']
output = cStringIO.StringIO()
print >> output, "test"
output.write(input.read(int(environ.get('CONTENT_LENGTH', '0'))))
return [output.getvalue()]
无论如何要设置它,这样我就可以编写python脚本并且只需:
print "test"