0

我在这里的第一篇文章并寻求建议。几天来,我一直在尝试让 Mercurial 服务器启动并在我的工作中运行。但我因同样的错误而惨遭失败。由于我无法控制的原因,它必须通过 Apache 访问。

我目前有:

  • 视窗服务器 2008 R2
  • 阿帕奇 2.2
  • 蟒蛇 2.7
  • 水银 2.7.2
  • 用于测试的本地存储库(在 C:\Repositories\repo1 中)
  • mod_wsgi

我的 hgweb.config 和 hgweb.wsgi 位于 C:\Repositories 中,并且与 httpd.conf 一起看起来像这样:

hgweb.config

[paths]
/ = C:/Repositories/*

[web]
style = coal
push_ssl = false

hgweb.wsgi

config = "C:\Repositories\hgweb.config"
#import sys; sys.path.insert(0, "C:\Program Files (x86)\Mercurial")
import sys; sys.path.insert(0, "C:\Python27\Lib\site-packages\mercurial")
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb
application = hgweb(config)

httpd.conf

<VirtualHost *>
    ServerName hg.example.net
    ServerAdmin me@myplace.com
    DocumentRoot "C:/Repositories"
    LogLevel debug
    ErrorLog C:/Repositories/error_log
    CustomLog C:/Repositories/access_log common
    LogLevel debug

    WSGIScriptAlias  /hg  "C:/Repositories/hgweb.wsgi"
    #WSGIScriptAlias  /  "C:/Repositories/Hello World.wsgi"

    <Directory C:/Repositories>
        Order allow,deny
        Allow from all      
        AllowOverride All
        AddHandler wsgi-script .wsgi
    </Directory>
</VirtualHost>

简单的 Hello World.wsgi 工作正常,这表明 Apache、Python 和 mod_wsgi 都可以很好地协同工作。但是,每当我使用 hgweb.wsgi 时,我都会收到内部服务器错误...联系我@myplace.com...虽然不起作用确实意味着它至少正在读取和使用 httpd.conf 中的 ServerAdmin

error.log 指出 hgweb.wsgi 不能作为 Python 模块加载(下面的输出去掉了日期、ip 等):

mod_wsgi (pid=4764): Target WSGI script 'C:/Repositories/hgweb.wsgi' cannot be loaded as Python module.
mod_wsgi (pid=4764): Exception occurred processing WSGI script 'C:/Repositories/hgweb.wsgi'.
Traceback (most recent call last):
  File "C:/Repositories/hgweb.wsgi", line 19, in <module>
    application = hgweb(config)
  File "C:\\Python27\\lib\\site-packages\\mercurial\\hgweb\\__init__.py", line 26, in hgweb
    return hgwebdir_mod.hgwebdir(config, baseui=baseui)
  File "C:\\Python27\\lib\\site-packages\\mercurial\\hgweb\\hgwebdir_mod.py", line 89, in __init__
    self.refresh()
  File "C:\\Python27\\lib\\site-packages\\mercurial\\hgweb\\hgwebdir_mod.py", line 98, in refresh
    u = ui.ui()
  File "C:\\Python27\\lib\\site-packages\\mercurial\\ui.py", line 45, in __init__
    for f in scmutil.rcpath():
  File "C:\\Python27\\lib\\site-packages\\mercurial\\demandimport.py", line 86, in __getattribute__
    self._load()
  File "C:\\Python27\\lib\\site-packages\\mercurial\\demandimport.py", line 58, in _load
    mod = _origimport(head, globals, locals)
  File "C:\\Python27\\lib\\site-packages\\mercurial\\scmutil.py", line 274, in <module>
    class vfs(abstractvfs):
  File "C:\\Python27\\lib\\site-packages\\mercurial\\scmutil.py", line 302, in vfs
    @util.propertycache
  File "C:\\Python27\\lib\\site-packages\\mercurial\\demandimport.py", line 86, in __getattribute__
    self._load()
  File "C:\\Python27\\lib\\site-packages\\mercurial\\demandimport.py", line 58, in _load
    mod = _origimport(head, globals, locals)
  File "C:\\Python27\\lib\\site-packages\\mercurial\\util.py", line 27, in <module>
    cachestat = platform.cachestat
  File "C:\\Python27\\lib\\site-packages\\mercurial\\demandimport.py", line 86, in __getattribute__
    self._load()
  File "C:\\Python27\\lib\\site-packages\\mercurial\\demandimport.py", line 58, in _load
    mod = _origimport(head, globals, locals)
  File "C:\\Python27\\lib\\site-packages\\mercurial\\windows.py", line 36, in <module>
    posixfile.__doc__ = osutil.posixfile.__doc__
  File "C:\\Python27\\lib\\site-packages\\mercurial\\demandimport.py", line 86, in __getattribute__
    self._load()
  File "C:\\Python27\\lib\\site-packages\\mercurial\\demandimport.py", line 58, in _load
    mod = _origimport(head, globals, locals)
ImportError: DLL load failed: %1 is not a valid Win32 application.

任何帮助或想法都将受到欢迎。

提前致谢。

4

0 回答 0