【发布时间】:2013-05-15 19:57:42
【问题描述】:
我正在尝试在 mac osx 上的默认 apache 服务器中安装 mod_wsgi 模块。我正在关注this guy's tutorial. 我已经到了将模块添加到 apache 配置的部分,我插入了这两行:
$ sudo nano /private/etc/apache2/httpd.conf
...
LoadModule wsgi_module libexec/apache2/mod_wsgi.so
WSGIScriptAlias / /Library/WebServer/Documents/
...
回到我输入的终端:
sudo /usr/sbin/apachectl restart
当我在浏览器中访问 localhost/testpy.py 时,我收到一条错误消息,提示无法连接到本地主机。这是我的testpy.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]
编辑
当我添加这两行代码时,apache 错误日志不会产生任何内容。当我把它们拿出来并转到一个我知道在错误日志中得到它之前有效的 URL 时:
caught SIGTERM, shutting down
Init: Session Cache is not configured [hint: SSLSessionCache]
httpd: Could not reliably determine the server's fully qualified domain name, using my-machine.local for ServerName
Digest: generating secret for digest authentication ...
Digest: done
Apache/2.2.22 (Unix) DAV/2 PHP/5.3.15 with Suhosin-Patch mod_ssl/2.2.22 OpenSSL/0.9.8r configured -- resuming normal operations
【问题讨论】:
-
在浏览器中输入
http://127.0.0.1/会发生什么? -
我认为您的教程让您误入歧途,您可能想找一个不同的...
-
@MattDMo 也许是……你能给我指一个不同的吗?
http://127.0.0.1/产生同样的问题。 -
我个人非常喜欢Django。设置起来非常简单,他们有一个很棒的教程来让一切顺利进行。最重要的是,它包含自己的开发服务器,所以一开始你甚至不需要 Apache/mod_wsgi。
-
另外,请确保您已关注these instructions 在 OSX 上安装
mod_wsgi