zoukankan      html  css  js  c++  java
  • Trac安装手记及与Visual SVN Server集成

      项目越来越大,参加的人员也越来越多,为了管理上的方便,需要引用系统进行辅助.基于Trac的开源性质,以及其能与Subversion很好的集成,故选Trac.
      Trac是基于Python开发的.对我这个之前从未接触的来说,安装也是件很费心的事情,经过两周的折腾,总算成功的安装,并与VisualSVN Server成功的集成了,在XP SP3, Win2K3,及Win2K8 R2上成功安装,本次的安装选用目前的稳定版本Trac 0.12.记录如下:
      Subversion的服务器先前已经准备好,以前安装的是VisualSVN server,这个安装在此就不做说明了.
      依官网上的说明,针对Trac的依赖部分, 下载如下文件
      
    1. Python>=2.4 < 3.0; 选用Python 2.6.3, 直接安装,安装后加全局变量中加入PYTHONHOME=XXX; Path中加入%PYTHONHOME%; %PYTHONHOME%\scripts; 重起机器
      2.Setuptools >= 0.6(用于egg的安装);  选用setuptool-0.6c11 for py2.6  
      3. Genshi >=0.6(自Trac 0.11以来的页面引擎); 选用Genshi-0.6-py2.6.egg ;安装方式为easy_install Genshi-0.6-py2.6.egg
      4. DB(可支持的为SQLite, PostgreSQL, MySQL). 我选用的为PostgreSQL 8.4.8
      5. 因选用的为PostgreSQL,故还需要Python的PostgreSQL的plugin, psycopg2, 在Windows下的安装直接找Win32 setup版本的安装比较方便,否则会出错.
      6. Python的其他Package, Trac的增强部分, Babel 本地化插件; docutils wiki的操作相关, Pyments 语法高亮插件; pytz时区的插件, 这些的安装都是通过setup.py install的方式进行的.
      7. Trac的安装,选用的为0.12版本
      因为要与版本管控进行集成,所以还会涉及Subversion的插件部分,(如没有与Subversion集成,则不需要如下的)
      8. Subversion的Python plugin,我选用的为svn-win32-1.6.16_py.zip. 安装的方式为将解压出来的libsvn及svn目录copy到%Pythonhome%\lib\site-packages下,并依要求将libsvn下的.dll改为.pyd, 注意libsvn_swig_py-1.dll这个文件不能修改.
      为了与VisualSVN server集成,我们还需要准备
      9. Subversion的安装文件, Setup-Subversion-1.6.16, 虽然我们已经有了VisualSVN server,但无法与Python的SVN插件工作,故我们还是要下载这个安装后,将BIN目录下的文件COPY覆盖VisualSVN Server下的BIN目录下的同名文件. 同时在Path中加到VisualSVN server安装路径下的bin目录
      10. apach的wsgi的插件,这个是Trac推荐的方式. mod_wsgi.so. 将其COPY至visualSVN server安装的bin目录下,备用.
      以上安装好了以后,接下来就是配置部分了.(如下以我安装的实际路径为例)
      1. 执行trac-admin c:\trac_home\5th initenv; 依提示输入你的项目称, 及DB的访问字串. 我选用的为PostgreSQL, 故格式为:postgres://user:pass@localhost:5432/dbname?schema=schemaname
      2. 通过tracd -p 8080 c:\trac_home\5th起动WEB服务, 然后在浏览器地址栏中输入http://localhost:8080/trac_home/5th来确认是否安装成功,如果成功,可以正常的浏览.
      3. 设置版本库, Trac仅支持版本库与Trac在同一台机器上. 在c:\trac_home\5th\conf\trac.ini, 中在trac段中的 repository_dir =C:\Repositories\Repository, 重启Trac.
      4. 此时访问Trac会提示版本库未同步,故执行trac-admin c:\trac_home\5th repository resync '*' 进行版本库的同步,将SVN的版本库同步至TRAC所DB中. 这些访问就可以正常了.
      5.接下来是最后一步与VisualSVN Server的集成.
        1) 在Visual SVN Server的安装路径下conf\httpd-custom.conf文件中加入, 用户必须存在于VisualSVN server中.
    LoadModule wsgi_module bin/mod_wsgi.so
    LoadModule authz_user_module bin/mod_authz_user.so
    
    WSGIScriptAlias /trac/5th c:\Trac_home\5th\trac.wsgi
    
    <Directory c:\Trac_home>
       WSGIApplicationGroup %{GLOBAL}
    #    Order deny,allow
    #    Allow from all
    </Directory>
    
    <Location '/trac/5th/login'>
    AuthType Basic
    AuthName "Trac_home 5th"
    AuthUserFile C:/Repositories/htpasswd
    Require valid-user
    </Location>
    

        2) 在c:\trac_home\5th下增加trac.wsgi文件, 内容为
          
    #!C:\Python27\python.exe
    # -*- coding: utf-8 -*-
    #
    # Copyright (C)2008-2009 Edgewall Software
    # Copyright (C) 2008 Noah Kantrowitz <noah@coderanger.net>
    # All rights reserved.
    #
    # This software is licensed as described in the file COPYING, which
    # you should have received as part of this distribution. The terms
    # are also available at http://trac.edgewall.org/wiki/TracLicense.
    #
    # This software consists of voluntary contributions made by many
    # individuals. For the exact contribution history, see the revision
    # history and logs, available at http://trac.edgewall.org/log/.
    #
    # Author: Noah Kantrowitz <noah@coderanger.net>
    import os
    
    def application(environ, start_request):
        if not 'trac.env_parent_dir' in environ:
            environ.setdefault('trac.env_path', 'c:\\trac_home\\5th')
        if 'PYTHON_EGG_CACHE' in environ:                                           
            os.environ['PYTHON_EGG_CACHE'] = environ['PYTHON_EGG_CACHE']
        elif 'trac.env_path' in environ:
            os.environ['PYTHON_EGG_CACHE'] = \
                os.path.join(environ['trac.env_path'], '.egg-cache')
        elif 'trac.env_parent_dir' in environ:
            os.environ['PYTHON_EGG_CACHE'] = \
                os.path.join(environ['trac.env_parent_dir'], '.egg-cache')
        from trac.web.main import dispatch_request
        return dispatch_request(environ, start_request)
    
        3)重启Visual SVN server, 即可正常访问 http://localhost/trac/5th
      至此, Trac的安装与VisualSVN SERVER的集成完毕
      参考资料:
      1. Trac官网 http://trac.edgewall.org;
      2. 博园 http://www.cnblogs.com/xwing/archive/2011/04/25/2026526.html
    
  • 相关阅读:
    HTTP 缓存图解
    http协议构成整理
    HTTP2.0
    Event Loop
    斐波那契数列
    归并排序
    快速排序
    史上最全前端资源
    Js 将 Date 转化为指定格式的String
    vue-cli webpack全局引入jquery
  • 原文地址:https://www.cnblogs.com/jeanvixue/p/2049375.html
Copyright © 2011-2022 走看看