mod_wsgi在WAMP中不起作用

1 投票
2 回答
1259 浏览
提问于 2025-04-17 07:11

我安装了Python 2.7和mod_wsgi。我在Apache的http.conf文件中添加了

LoadModule wsgi_module modules/mod_wsgi.so

(我使用的是WAMP 2.2a和Windows 7 Ultimate 64位)。在我的www文件夹里,有一个名为test.py的文件,里面有以下代码:

def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'

response_headers = [('Content-type', 'text/plain'),
                    ('Content-Length', str(len(output)))]
start_response(status, response_headers)

return [output]

这个文件会像普通文本文件一样直接输出内容。可惜我在网上搜索没有找到更好的解决办法,你知道可能是什么问题,或者我遗漏了什么吗?

2 个回答

0

你在用64位的WAMP吗?

如果是的话,你需要确保你使用的是64位的mod_wsgi。

你可以在这里找到它:http://www.lfd.uci.edu/~gohlke/pythonlibs/

2

听起来你还没有告诉Apache去处理那个应用程序,使用的是wsgi。你有没有按照这些说明去操作呢?

撰写回答