Trac project-creating example

Create a Trac Project

建立資料庫

D:\Python24\Scripts> trac-admin.py D:\Repository\trac\sandbox initenv

接著會出現以下提示文字,請依照下面的建議操作:

Project Name [My Project]> sandbox (輸入專案名稱,不必和目錄名稱相同)
Database connection string [sqlite:db/trac.db]> (直接按 Enter 使用預設值)
Repository type [svn]> (直接按 Enter 使用預設值)
Path to repository [/path/to/repos]> D:\Repository\svn\sandbox (svn 檔案庫的位置)
Templates directory [D:\AppServ\Python24\share\trac\templates]> (直接按 Enter 使用預設值)

存取權限設定1

將 admin 加入 Trac 專案管理者:

D:\Python24\Scripts> trac-admin.py D:\Repository\trac\sandbox permission add admin TRAC_ADMIN

建立一個 members 群組,給它需要的權限2

D:\Python24\Scripts> trac-admin.py D:\Repository\trac\sandbox permission add members WIKI_CREATE WIKI_MODIFY TICKET_APPEND TICKET_CREATE CONFIG_VIEW SEARCH_VIEW TIMELINE_VIEW ROADMAP_VIEW BROWSER_VIEW FILE_VIEW CHANGESET_VIEW LOG_VIEW

取消匿名使用者權限:

D:\Python24\Scripts> trac-admin.py D:\Repository\trac\sandbox permission remove anonymous *

賦予匿名使用者一些 View 相關的權限:

D:\Python24\Scripts> trac-admin.py D:\Repository\trac\sandbox permission add anonymous WIKI_VIEW SEARCH_VIEW TICKET_VIEW TIMELINE_VIEW REPORT_VIEW BROWSER_VIEW FILE_VIEW CHANGESET_VIEW

檢查 Trac 安裝是否正確

You can also use Trac with other webservers, but you should first try tracd to make sure everything's set up and working correctly:

D:\Python24\Scripts> tracd.py -p 8080 D:\Repository\trac\sandbox

Trac 相關 Plugins 設定

建立好 Trac 資料庫後,就要在專案裡啟用 WebAdmin 和 AccountManager 這兩個 Plugins 。請用文字編輯器打開 D:\Repository\trac\projectname\conf\trac.ini ,把以下文字貼到 trac.ini 的最下方:

# for the usage of Trac with Apache2
[account-manager]
password_file = D:\Repository\users.passwd
password_store = HtPasswdStore

# for the Trac plugins
[components]
acct_mgr.admin.accountmanageradminpage = enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.htfile.htpasswdstore = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
acct_mgr.web_ui.registrationmodule = enabled
trac.web.auth.loginmodule = enabled
iniadmin.iniadmin.iniadminplugin = enabled
webadmin.* = enabled
includemacro.macros.includemacro = enabled

這樣到時候用 admin 登入專案時,就能夠使用 Admin 功能了 (包含 WebAdmin 、 AccountManager 和 IniAdmin ) 。

Change project name

Example

We want change "DVP-A1006" to "A1006"

  1. rename "D:\Repository\svn\DVP-A1006" to "D:\Repository\svn\A1006"
  2. rename "D:\Repository\trac\DVP-A1006" to "D:\Repository\trac\A1006"
  3. Edit D:\Repository\trac\A1006\conf\trac.ini
    1. search all "DVP-A1006" and replace to "A1006"
  4. Resync

D:\Python24\Scripts> trac-admin.py D:/Repository/trac/sandbox resync

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License