trac1.0部署方式

学习trac1.0部署方式。

安装

  1. 下载并安装Python2.7;
  2. 执行https://pypi.python.org/pypi/setuptools 的简易脚本安装setuptools;
  3. 执行easy_install Trac==1.0安装trac1.0

创建环境

  1. 创建运行环境。
trac-admin /path/to/myproject initenv
  1. 使用脚本生成认证文件。
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])))
  1. 为用户添加管理权限。
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

  1. http://trac-hacks.org/wiki/FullBlogPlugin 下载源码;
  2. 解压后在相应文件夹执行
python setup.py install
  1. 在trac.ini中添加:
[components]
tracfullblog.* = enabled
  1. 执行环境更新:
trac-admin /path/to/env upgrade
  1. 使用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
    

以上。 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值