Home | 簡體中文 | 繁體中文 | 雜文 | 知乎專欄 | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 視頻教程 | 打賞(Donations) | About
知乎專欄多維度架構 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者”

166.3. Project Environment

166.3.1. Sqlite

  1. Creating a Project Environment

    					
    $ trac-admin /home/netkiller/projectenv initenv
    
    Creating a new Trac environment at /home/netkiller/projectenv
    
    Trac will first ask a few questions about your environment
    in order to initalize and prepare the project database.
    
     Please enter the name of your project.
     This name will be used in page titles and descriptions.
    
    Project Name [My Project]>
    
     Please specify the connection string for the database to use.
     By default, a local SQLite database is created in the environment
     directory. It is also possible to use an already existing
     PostgreSQL database (check the Trac documentation for the exact
     connection string syntax).
    
    Database connection string [sqlite:db/trac.db]>
    
     Please specify the type of version control system,
     By default, it will be svn.
    
     If you don't want to use Trac with version control integration,
     choose the default here and don't specify a repository directory.
     in the next question.
    
    Repository type [svn]>
    
     Please specify the absolute path to the version control
     repository, or leave it blank to use Trac without a repository.
     You can also set the repository location later.
    
    Path to repository [/path/to/repos]> /home/netkiller/repos
    
     Please enter location of Trac page templates.
     Default is the location of the site-wide templates installed with Trac.
    
    Templates directory [/usr/share/trac/templates]>
    
    Creating and Initializing Project
     Installing default wiki pages
     /usr/share/trac/wiki-default/TracIni => TracIni
     /usr/share/trac/wiki-default/TracSupport => TracSupport
     /usr/share/trac/wiki-default/WikiStart => WikiStart
     /usr/share/trac/wiki-default/TitleIndex => TitleIndex
     /usr/share/trac/wiki-default/TracModPython => TracModPython
     /usr/share/trac/wiki-default/TracInterfaceCustomization => TracInterfaceCustomization
     /usr/share/trac/wiki-default/WikiDeletePage => WikiDeletePage
     /usr/share/trac/wiki-default/TracTicketsCustomFields => TracTicketsCustomFields
     /usr/share/trac/wiki-default/TracChangeset => TracChangeset
     /usr/share/trac/wiki-default/TracLogging => TracLogging
     /usr/share/trac/wiki-default/TracSyntaxColoring => TracSyntaxColoring
     /usr/share/trac/wiki-default/TracImport => TracImport
     /usr/share/trac/wiki-default/TracTimeline => TracTimeline
     /usr/share/trac/wiki-default/TracAdmin => TracAdmin
     /usr/share/trac/wiki-default/InterWiki => InterWiki
     /usr/share/trac/wiki-default/WikiPageNames => WikiPageNames
     /usr/share/trac/wiki-default/TracNotification => TracNotification
     /usr/share/trac/wiki-default/TracFastCgi => TracFastCgi
     /usr/share/trac/wiki-default/InterTrac => InterTrac
     /usr/share/trac/wiki-default/TracUnicode => TracUnicode
     /usr/share/trac/wiki-default/TracGuide => TracGuide
     /usr/share/trac/wiki-default/TracRevisionLog => TracRevisionLog
     /usr/share/trac/wiki-default/TracBrowser => TracBrowser
     /usr/share/trac/wiki-default/WikiRestructuredText => WikiRestructuredText
     /usr/share/trac/wiki-default/TracLinks => TracLinks
     /usr/share/trac/wiki-default/TracInstall => TracInstall
     /usr/share/trac/wiki-default/TracPermissions => TracPermissions
     /usr/share/trac/wiki-default/WikiMacros => WikiMacros
     /usr/share/trac/wiki-default/TracQuery => TracQuery
     /usr/share/trac/wiki-default/TracBackup => TracBackup
     /usr/share/trac/wiki-default/TracWiki => TracWiki
     /usr/share/trac/wiki-default/SandBox => SandBox
     /usr/share/trac/wiki-default/TracRoadmap => TracRoadmap
     /usr/share/trac/wiki-default/TracAccessibility => TracAccessibility
     /usr/share/trac/wiki-default/TracSearch => TracSearch
     /usr/share/trac/wiki-default/TracPlugins => TracPlugins
     /usr/share/trac/wiki-default/RecentChanges => RecentChanges
     /usr/share/trac/wiki-default/WikiNewPage => WikiNewPage
     /usr/share/trac/wiki-default/TracCgi => TracCgi
     /usr/share/trac/wiki-default/TracRss => TracRss
     /usr/share/trac/wiki-default/CamelCase => CamelCase
     /usr/share/trac/wiki-default/WikiFormatting => WikiFormatting
     /usr/share/trac/wiki-default/TracTickets => TracTickets
     /usr/share/trac/wiki-default/TracStandalone => TracStandalone
     /usr/share/trac/wiki-default/InterMapTxt => InterMapTxt
     /usr/share/trac/wiki-default/TracReports => TracReports
     /usr/share/trac/wiki-default/WikiHtml => WikiHtml
     /usr/share/trac/wiki-default/WikiProcessors => WikiProcessors
     /usr/share/trac/wiki-default/TracUpgrade => TracUpgrade
     /usr/share/trac/wiki-default/TracEnvironment => TracEnvironment
     /usr/share/trac/wiki-default/WikiRestructuredTextLinks => WikiRestructuredTextLinks
    
    Warning:
    
    You should install the SVN bindings
    
    ---------------------------------------------------------------------
    Project environment for 'My Project' created.
    
    You may now configure the environment by editing the file:
    
      /home/netkiller/projectenv/conf/trac.ini
    
    If you'd like to take this new project environment for a test drive,
    try running the Trac standalone web server `tracd`:
    
      tracd --port 8000 /home/netkiller/projectenv
    
    Then point your browser to http://localhost:8000/projectenv.
    There you can also browse the documentation for your installed
    version of Trac, including information on further setup (such as
    deploying Trac to a real web server).
    
    The latest documentation can also always be found on the project
    website:
    
      http://trac.edgewall.org/
    
    Congratulations!
    					
    					
  2. Running the Standalone Server

    tracd --port 8000 /home/netkiller/projectenv
    					
  3. testing

    http://192.168.1.7:8000/projectenv/

  4. auth

    sudo apt-get install apache2-utils
    
    $ htdigest -c /home/neo/trac/conf/passwd.digest localhost neo
    Adding password for neo in realm localhost.
    New password:
    Re-type new password:
    
    $ htdigest /home/neo/trac/conf/passwd.digest localhost nchen
    Adding user nchen in realm localhost
    New password:
    Re-type new password:
    
    $ trac-admin /home/neo/trac permission add admin TRAC_ADMIN
    $ trac-admin /home/neo/trac permission add netkiller admin
    
    $ trac-admin /home/neo/trac permission add developer TICKET_ADMIN
    $ trac-admin /home/neo/trac permission add nchen developer
    $ trac-admin /home/neo/trac permission add neo developer
    
    $ trac-admin /home/neo/trac permission list
    User           Action
    ------------------------------
    admin          TRAC_ADMIN
    anonymous      BROWSER_VIEW
    anonymous      CHANGESET_VIEW
    anonymous      FILE_VIEW
    anonymous      LOG_VIEW
    anonymous      MILESTONE_VIEW
    anonymous      REPORT_SQL_VIEW
    anonymous      REPORT_VIEW
    anonymous      ROADMAP_VIEW
    anonymous      SEARCH_VIEW
    anonymous      TICKET_VIEW
    anonymous      TIMELINE_VIEW
    anonymous      WIKI_VIEW
    authenticated  TICKET_CREATE
    authenticated  TICKET_MODIFY
    authenticated  WIKI_CREATE
    authenticated  WIKI_MODIFY
    developer      TICKET_ADMIN
    nchen          developer
    neo            developer
    netkiller      admin
    					
  5. daemon

    $ tracd -d -s --port 8000 /home/netkiller/projectenv
    $ tracd -d -s --port 8000 --auth trac,/home/neo/trac/conf/passwd.digest,localhost /home/neo/trac
    					

166.3.2. MySQL

GRANT ALL PRIVILEGES ON trac.* TO trac@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
CREATE DATABASE IF NOT EXISTS trac default charset utf8 COLLATE utf8_general_ci;
			
Database connection string [sqlite:db/trac.db]> mysql://trac:password@localhost:3306/trac
			

下面開始創建項目

			
# trac-admin /home/git/trac initenv
Creating a new Trac environment at /home/git/trac

Trac will first ask a few questions about your environment
in order to initialize and prepare the project database.

 Please enter the name of your project.
 This name will be used in page titles and descriptions.

Project Name [My Project]>

 Please specify the connection string for the database to use.
 By default, a local SQLite database is created in the environment
 directory. It is also possible to use an already existing
 PostgreSQL database (check the Trac documentation for the exact
 connection string syntax).

Database connection string [sqlite:db/trac.db]> mysql://trac:trac@localhost:3306/trac

Creating and Initializing Project
 Installing default wiki pages
  TracRepositoryAdmin imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracRepositoryAdmin
  TracNavigation imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracNavigation
  TracUpgrade imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracUpgrade
  TracRevisionLog imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracRevisionLog
  TracTickets imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracTickets
  TracIni imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracIni
  PageTemplates imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/PageTemplates
  TracTimeline imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracTimeline
  TracAccessibility imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracAccessibility
  WikiHtml imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/WikiHtml
  SandBox imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/SandBox
  TracImport imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracImport
  TracPlugins imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracPlugins
  TracRoadmap imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracRoadmap
  TracAdmin imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracAdmin
  TracBatchModify imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracBatchModify
  TracBrowser imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracBrowser
  InterWiki imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/InterWiki
  WikiRestructuredText imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/WikiRestructuredText
  WikiProcessors imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/WikiProcessors
  WikiNewPage imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/WikiNewPage
  TracEnvironment imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracEnvironment
  TracLogging imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracLogging
  TracSupport imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracSupport
  TracNotification imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracNotification
  TracGuide imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracGuide
  WikiStart imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/WikiStart
  TracWorkflow imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracWorkflow
  TracRss imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracRss
  TracLinks imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracLinks
  InterMapTxt imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/InterMapTxt
  WikiPageNames imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/WikiPageNames
  WikiFormatting imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/WikiFormatting
  WikiRestructuredTextLinks imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/WikiRestructuredTextLinks
  TracUnicode imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracUnicode
  TracChangeset imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracChangeset
  TitleIndex imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TitleIndex
  WikiDeletePage imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/WikiDeletePage
  TracReports imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracReports
  TracWiki imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracWiki
  RecentChanges imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/RecentChanges
  TracBackup imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracBackup
  TracModPython imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracModPython
  TracSearch imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracSearch
  TracModWSGI imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracModWSGI
  TracTicketsCustomFields imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracTicketsCustomFields
  TracQuery imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracQuery
  TracStandalone imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracStandalone
  InterTrac imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/InterTrac
  TracFineGrainedPermissions imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracFineGrainedPermissions
  TracInterfaceCustomization imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracInterfaceCustomization
  TracCgi imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracCgi
  TracFastCgi imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracFastCgi
  TracPermissions imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracPermissions
  TracInstall imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracInstall
  TracSyntaxColoring imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/TracSyntaxColoring
  CamelCase imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/CamelCase
  WikiMacros imported from /root/.python-eggs/Trac-1.1.1-py2.6.egg-tmp/trac/wiki/default-pages/WikiMacros

---------------------------------------------------------------------
Project environment for 'My Project' created.

You may now configure the environment by editing the file:

  /home/git/trac/conf/trac.ini

If you'd like to take this new project environment for a test drive,
try running the Trac standalone web server `tracd`:

  tracd --port 8000 /home/git/trac

Then point your browser to http://localhost:8000/trac.
There you can also browse the documentation for your installed
version of Trac, including information on further setup (such as
deploying Trac to a real web server).

The latest documentation can also always be found on the project
website:

  http://trac.edgewall.org/

Congratulations!
			
			

166.3.3. Plugin

166.3.3.1. AccountManagerPlugin

http://trac-hacks.org/wiki/AccountManagerPlugin

cd accountmanagerplugin/
python setup.py install
python setup.py bdist_egg

cp dist/TracAccountManager-0.4.4-py2.6.egg /home/git/trac/plugins/
				
166.3.3.2. Subtickets

http://trac-hacks.org/wiki/SubticketsPlugin