【问题标题】:apache error installing trac / wsgi / python安装 trac / wsgi / python 的 apache 错误
【发布时间】:2011-08-08 17:00:24
【问题描述】:

我第一次安装 wsgi/trac/python 时遇到性能问题。我们是第一次设置 trac,但遇到了一些问题。

据我所知,我已经在正确的位置设置了组件,我的 Apache 通过 Wamp 托管,我将使用 MySql 5.x 作为数据库后端。

当我在我的 Apache 配置中禁用 WSGI 时,Wamp/Apache 可以正常加载。我可以浏览到我的 localhost、phpmyadmin 等,没问题。

但是,当启用 WSGI 时,我的 Apache 错误日志显示以下消息,这些消息似乎一直在循环,我的本地主机从不响应,我的 phpmyadmin 也没有。

我怀疑存在一些配置循环,但我无法告诉您在哪里寻找什么,需要一些指导。

我们的 Apache 配置中是否还有其他我遗漏的内容?

ImportError: No module named site 
[Mon Aug 08 10:49:51 2011] [notice] Parent: child process exited with status 1 -- Restarting. 
[Mon Aug 08 10:49:51 2011] [warn] mod_wsgi: Compiled for Python/2.7. 
[Mon Aug 08 10:49:51 2011] [warn] mod_wsgi: Runtime using Python/2.7.2. 
[Mon Aug 08 10:49:51 2011] [notice] Apache/2.2.17 (Win32) mod_wsgi/3.3 Python/2.7.2 PHP/5.3.5 configured -- resuming normal operations 
[Mon Aug 08 10:49:51 2011] [notice] Server built: Oct 18 2010 01:58:12 
[Mon Aug 08 10:49:51 2011] [notice] Parent: Created child process 3116 
[Mon Aug 08 10:49:51 2011] [warn] mod_wsgi: Compiled for Python/2.7. 
[Mon Aug 08 10:49:51 2011] [warn] mod_wsgi: Runtime using Python/2.7.2.
[Mon Aug 08 10:49:51 2011] [notice] Child 3116: Child process is running

谢谢...

【问题讨论】:

  • 在通往运行 trac 系统的道路上还有其他机会,但是,我相信我已经解决了这个问题。似乎 Apache httpd.conf 文件需要这样的块:WSGIPythonHome pathtoyourpythondllandorlibs。这似乎解决了眼前的问题;不要再折腾了。
  • 如果您自己解决了问题,我认为您应该将其写为答案,而不是评论,并将其标记为已接受。
  • mod_wsgi 模块不需要设置 WSGIPythonHome。该选项存在,但在 Windows 上,您需要它的情况极为罕见,并且认为我只听说过它所在的一个实例。您的问题没有明确说明循环消息是在 Apache 启动时立即出现,还是在首次请求 Trac 时发生。如果您的系统上安装了多个 Python,您还需要概述。

标签: python apache trac wsgi


【解决方案1】:

当我们安装 Python 时,它的安装程序会在 Windows 中设置注册表,因此 wsgi 应该能够在不使用 ConfigurationDirectives 的情况下轻松找到 Python 模块。

HKLM/Software/PythonHKLM/Software/WOW6432Node/Python

在该注册表中指定了 PythonPath 和 InstallPath,它可以从中搜索模块、dll、库等...

当名为mod_wsgi的apache模块找不到这些目录时会出现以下错误

ImportError: No module named site

因此,通过在 apache 配置文件中添加以下行,我们指定 Python 的 dll/lib 目录

<IfModule wsgi_module>
WSGIPythonHome pathtoyourpythondllandorlibs
</IfModule>

更多关于 mod_wsgi 的 ConfigurationDirectives 可以在 http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives

【讨论】:

  • 应该为所有用户安装 Python,而不仅仅是 Windows 系统上的当前用户。这样做,你就不会遇到这个问题。在 Windows 系统上依赖 WSGIPythonHome 是个坏主意,因为它可能无法解决所有问题,即 Apache 服务以与安装 Python 的用户不同的用户身份运行。
猜你喜欢
  • 2020-08-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-09-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多