日期:2014-05-16  浏览次数:20579 次

trac安装、配置、中文化、支持git(Linux,Mac)

我是用pip进行python包安装的!

?

整个过程还挺折腾,都怪文档有限,所以写下我的流程,给大家一个参考。

先确定版本

python 2.7.1

?

Babel==0.9.6

Genshi==0.6(安装trac的时候,这个是依赖自动装的,是一个模板系统)

Trac==0.12.2

TracGit==0.12.0.5dev

?

一、安装

?

1,安装Babel,trac的l10n组件,必须先安装babel否则trac出不了中文

pip install babel

? 2,安装Trac

pip install trac

?

二、初始化

?

trac-admin?~/trac-sites/myproj?initenv

这个会提示让你输入项目名称和持久化方式,项目名称我就写了‘myproj’和目录保持一致,这个后边有点用,持久化我就用了默认的sqlite,其他的还没有研究

?

三、配置

?

1,修改site logo

把你的logo文件放到:~/trac-sites/myproj/htdocs/logo.jpg

修改trac.ini:

[header_Logo]

src = site/logo.png

2,字符集

貌似不改,中文会有问题,修改trac.ini

[trac]

default_charset = utf-8

3,用htpasswd生成passwd文件

这个是为了用户认证,用tracd启动trac时用,例:

htpasswd -c ~/trac-sites/myproj/htpasswd admin

这个会提示你输入passwd

?

四、启动

这个我只用tracd启动,还没有尝试用其他方式启动trac

tracd --port 8000 --basic-auth="myproj,~/trac-sites/myproj/htpasswd,realmname" ~/trac-sites/hua

?

五、git支持

?

1,安装GitPlugin ?http://trac-hacks.org/wiki/GitPlugin

easy_install http://github.com/hvr/trac-git-plugin/tarball/master

2,添加git repository(/git/myproj)

在trac.ini中添加

[components]

tracext.git.* = enabled

[git] cached_repository = true persistent_cache = true shortrev_len = 6 wiki_shortrev_len = 7 git_bin = /usr/bin/git git_fs_encoding = utf-8 trac_user_rlookup = true use_committer_id = false use_committer_time = false

修改trac.ini

[trac]

repository_dir = /git/myproj/.git repository_type = git

注意repository_dir = /git/myproj/.git必须把.git写上,否则他会说找不到控制文件的

?

六、访问

http://localhost:8000/

?