您的位置:首页 > 编程语言 > Python开发

Mercurial server 部署 服务

2010-03-14 20:30 260 查看
最近给老师 建立Mercurial server 端 琢磨了 网上的很久 才成功
(BTW :什么SSh不会啊)
 
 
1. 安装 Mercurial-1.3.1
http://mercurial.berkwood.com/binaries/Mercurial-1.3.1.exe
(为什么要用老版本? 我忘记了 -_-! )
someting I Miss 
-----------
还要 安装 CherryPy-3.1.2.win32.exe
------  
 
2. 安装 openlogic
https://olex.openlogic.com/packages/python?show=versions&version=2206
 
3.Mercurial + lib+lib/templates
在 Mercurial 安装目录 下解压一个叫 library.zip 到新建的 Lib 目录( e.g. C:/Program Files/Mercurial/Lib )
And 把( C:/Program Files/Mercurial/ templates ) templates 文件夹拷到 Lib 里
 
4. 建立 weddir 文件夹( C:/Program Files/Mercurial/ weddir )
里面 新建 2.bat 文件
Code
、、、、、、、、、、、、、、、
 
python cphgwebdir.py

、、、、、、、、、、、、、、、
新建 cphgwebdir.py
Code
//////////////////
# cphgwebdir.py with digest authentication
import os
import sys
import cherrypy
from paste.auth.digest import AuthDigestHandler, digest_password

# Adjust host and port to suit your Web presence:
sUrlHost='192.168.56.1'
iUrlPort=8080

# Adjust encoding to suit or comment out:
os.environ['HGENCODING']='UTF-8'

# Adjust path to your Mercurial Lib folder:
sys.path.append(r'C:/Program Files/Mercurial/Lib')
from mercurial.hgweb.hgwebdir_mod import hgwebdir

# Use same hgweb.config file as for hgwebdir.cgi
WsgiApp=hgwebdir('hgweb.config')

# Adjust realm to suit your needs
Realm='Mercurial Repositories'

# This is a sample dictionary of valid users with their digest encrypted password
dAuth={}
dAuth['judy']=digest_password(Realm,'judy','1234')
dAuth['jeremy']=digest_password(Realm,'jeremy','1234')

#dAuth['<username>']=digest_password('<realm>','<username>','<password>')

def AuthFunc(environ,realm,username):
return dAuth.get(username,None)

WsgiApp=AuthDigestHandler(WsgiApp,Realm,AuthFunc)

cherrypy.config.update({
# Default is development environment, uncomment below when in production
#'environment':'production',
'server.socket_host':sUrlHost,
'server.socket_port':iUrlPort,
#'log.access_file':'access.log',
'log.error_file':'error.log',
'log.screen':True
})
cherrypy.tree.graft(WsgiApp,script_name='/')
cherrypy.engine.start()
cherrypy.engine.block()


/////////////////
关键参数有
sUrlHost='192.168.56.1'  //server ip
iUrlPort=8080    //port No.
dAuth['judy']=digest_password(Realm,'judy','1234') //two accounts and passwords
dAuth['jeremy']=digest_password(Realm,'jeremy','1234')
 
最后新建 hgweb.config
。。。。。。。。。。。。。。。。
[paths]
myproject = F:/test/Comp2020
[web]
style = gitweb
push_ssl = false
allow_push = *


。。。。。。。。。。。。。。。。
关键参数
myproject = F:/test/Comp2020
(虚拟的目录) = (实际的目录映射)
 
5. 建立 reposity(ies)
到( F:/test/ )
建立 init.bat 文件
。。。。。。。。。。。。。。。。
hg init Comp2020
CD Comp2020
echo on "copy files to the directory (above)"
echo off
pause
echo "test">tes
del tes
hg commit -A -m "Initial commit"


。。。。。。。。。。。。。。。。。。。。。
当 CMD 窗口停顿时 就 copy 你的 project 到( F:/test/ )目录
Run init.bat
reposity is ready.
 
 
 
6. 安装 setuptools-0.6c11.win32-py2.5.exe
 
7. 安装 Paste-1.7.2.tar.gz
Cmd 打入
python setup.py install


 
8.run 2.bat ( C:/Program Files/Mercurial/ weddir )开启服务
 
download all :http://download.csdn.net/source/2128325
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息