学习trac1.0部署方式。
安装 ¶
- 下载并安装Python2.7;
- 执行https://pypi.python.org/pypi/setuptools 的简易脚本安装setuptools;
- 执行easy_install Trac==1.0安装trac1.0
创建环境 ¶
- 创建运行环境。
trac-admin /path/to/myproject initenv
- 使用脚本生成认证文件。
python trac-digest.py -u username -p password >> c:\digest.txt
脚本文件如下:
from optparse import OptionParser # The md5 module is deprecated in Python 2.5 try: from hashlib import md5 except ImportError: from md5 import md5 realm = 'trac' # build the options usage = "usage: %prog [options]" parser = OptionParser(usage=usage) parser.add_option("-u", "--username",action="store", dest="username", type = "string", help="the username for whom to generate a password") parser.add_option("-p", "--password",action="store", dest="password", type = "string", help="the password to use") parser.add_option("-r", "--realm",action="store", dest="realm", type = "string", help="the realm in which to create the digest") (options, args) = parser.parse_args() # check options if (options.username is None) or (options.password is None): parser.error("You must supply both the username and password") if (options.realm is not None): realm = options.realm # Generate the string to enter into the htdigest file kd = lambda x: md5(':'.join(x)).hexdigest() print ':'.join((options.username, realm, kd([options.username, realm, options.password])))
- 为用户添加管理权限。
trac-admin /path/to/myproject permission add admin TRAC_ADMIN
开启服务器 ¶
执行
tracd -p 8000 --auth=“proj_name,c:\digest.txt,trac” c:\path\to\proj_name
添加插件 ¶
git ¶
在trac.ini中添加和修改:
[components] tracopt.versioncontrol.git.* = enabled [git] git_bin = C:/Dev/msysgit/bin/git.exe [trac] repository_type = git repository_dir = /path/to/my/git/repository/.git
blog ¶
- 从http://trac-hacks.org/wiki/FullBlogPlugin 下载源码;
- 解压后在相应文件夹执行
python setup.py install
- 在trac.ini中添加:
[components] tracfullblog.* = enabled
- 执行环境更新:
trac-admin /path/to/env upgrade
- 使用trac-admin为用户添加blog权限,权限等级:BLOG_VIEW, BLOG_COMMENT, BLOG_MODIFY_OWN, BLOG_MODIFY_ALL, BLOG_CREATE, BLOG_ADMIN
trac-admin /path/to/myproject permission add admin BLOG_ADMIN
以上。