Hg WebServer 搭建

Posted wonderfuly

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Hg WebServer 搭建相关的知识,希望对你有一定的参考价值。

Win7系统 64位, 以下程序均为64位.

1. python-2.7.12.amd64.msi                        [必须]        本机测试安装目录  C:\\Python27

2. mercurial-4.7.1.win-amd64-py2.7.msi      [必须]       本机测试安装后自动到  C:\\Python27\\Lib\\site-packages

3. ttortoisehg-4.5.3-x64.msi                          [可选]       依赖 vc++2015

4. rewrite_amd64_zh-CN.msi                       [可选]       依赖 vc++2015

 

Traceback (most recent call last):
  File "thg", line 122, in <module>
  File "hgdemandimportdemandimportpy2.pyo", line 145, in __getattr__
  File "hgdemandimportdemandimportpy2.pyo", line 90, in _load
  File "hgdemandimportdemandimportpy2.pyo", line 41, in _hgextimport
  File "tortoisehghgqt
un.pyo", line 391, in <module>
  File "hgdemandimportdemandimportpy2.pyo", line 145, in __getattr__
  File "hgdemandimportdemandimportpy2.pyo", line 90, in _load
  File "hgdemandimportdemandimportpy2.pyo", line 41, in _hgextimport
  File "tortoisehghgqtqtapp.pyo", line 18, in <module>
  File "hgdemandimportdemandimportpy2.pyo", line 167, in _demandimport
  File "hgdemandimportdemandimportpy2.pyo", line 41, in _hgextimport
  File "tortoisehghgqtqtcore.pyo", line 53, in <module>
  File "hgdemandimportdemandimportpy2.pyo", line 167, in _demandimport
  File "hgdemandimportdemandimportpy2.pyo", line 41, in _hgextimport
  File "PyQt5QtCore.pyo", line 12, in <module>
  File "PyQt5QtCore.pyo", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.

 运行 TortoiseHg Workbench 出现如上错误请安装 Microsoft C++ 2015 Redistributable  https://www.microsoft.com/en-us/download/details.aspx?id=53587

 错误参照 -->  https://bitbucket.org/tortoisehg/thg/issues/4972/importerror-dll-load-failed

 

详细安装步骤请参照

http://www.cnblogs.com/gb2013/archive/2013/02/01/Mercurial_WebServer.html

 

hgweb.cgi 文件

#!C:/Python27/python.exe
#
# An example hgweb CGI script, edit as necessary
# See also http://mercurial.selenic.com/wiki/PublishingRepositories
# Path to repo or hgweb config to serve (see ‘hg help hgweb‘)
config = "C:/SourceCode/hgweb.config"
# Uncomment and adjust if Mercurial is not installed system-wide:
import sys
sys.path.insert(0, "C:\\Python27\\Lib\\site-packages")
# Uncomment to send python tracebacks to the browser if an error occurs:
import cgitb
cgitb.enable()
from mercurial import demandimport
demandimport.enable() 
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
wsgicgi.launch(application)

hgweb.config 文件

[paths] 
/Repositories/ = C:/SourceCode/* 
[web] 
encoding = UTF-8
descend = True
push_ssl = false
baseurl = /
allow_read = *
allow_push = *

web.config 文件

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="CGIHandler" path="*.cgi" verb="*" modules="CgiModule" scriptProcessor="C:Python27python.exe -u &quot;%s&quot; &quot;%s&quot;" resourceType="Unspecified" />
        </handlers>
        <defaultDocument>
            <files>
                <add value="hgweb.cgi" />
            </files>
        </defaultDocument>
    <rewrite>
      <rules>
        <clear />
        <rule name="hgweb.cgi" enabled="true" patternSyntax="Wildcard">
          <match url="*" />
          <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          </conditions>
          <action type="Rewrite" url="hgweb.cgi/{R:1}" />
        </rule>
      </rules>
    </rewrite>
    <security>
      <authorization>
        <remove users="*" roles="" verbs="" />
        <add accessType="Allow" users="*" />
      </authorization>
    </security>
    </system.webServer>
</configuration>

 

以上是关于Hg WebServer 搭建的主要内容,如果未能解决你的问题,请参考以下文章

ubuntu下apache+mysql+php+mysql等之webserver搭建

搭建CentOs7的WebServer

使用Nginx搭建图片服务器 #yyds干货盘点#

使用Nginx搭建图片服务器 #yyds干货盘点#

hg命令

Python编程入门与实践pdf电子版下载