我的设置涉及 apache 2.2.17、mod_wsgi 3.3、python 2.7.2、trac 0.12.2、mercurial 1.8.4。两个问题浮出水面:
- mercurial demandimport 初始化顺序
- mercurial 无法在站点包中加载 DLL。
我解决了如下问题:
- 更改 hgwebdir.wsgi 以禁用需求导入:
from mercurial import demandimport; demandimport.disable()
- 创建一个纯的(仅 .py,没有编译的 .pyd)mercurial 包并安装。另请参阅https://www.mercurial-scm.org/wiki/WindowsInstall
E:\Dist\mercurial-1.8.4>setup.py --pure build
E:\Dist\mercurial-1.8.4>setup.py --pure install
编译后的版本(使用 Microsoft Visual Studio 2008)无法加载 DLL:
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] mod_wsgi (pid=6092): Exception occurred processing WSGI script 'D:/Home/web/apache/cgi-bin/hgwebdir.wsgi'.
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] Traceback (most recent call last):
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "D:/Home/web/apache/cgi-bin/hgwebdir.wsgi", line 9, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] from mercurial.hgweb.hgwebdir_mod import hgwebdir
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\hgweb\\__init__.py", line 10, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] import hgweb_mod, hgwebdir_mod
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\hgweb\\hgweb_mod.py", line 10, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] from mercurial import ui, hg, hook, error, encoding, templater
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\ui.py", line 10, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] import config, util, error
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\config.py", line 9, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] import error, util
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\util.py", line 17, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] import error, osutil, encoding
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] ImportError: DLL load failed: The specified module could not be found.