<< 使用Hibernate Shards来访问多个水平分区数据库 | 首页 | 我收藏的链接(33) >>

在Windows上安装Trac并集成SVN

在Windows上安装Trac并集成SVN,原文来自官方的Trac On Windows。Trac是一个wiki和Issue跟踪的项目管理系统,集成SVN能让变更管理和SVN配置管理更加使用。

关于Subversion的安装,可以参考Apache和Subversion集成安装与配置

Installing Python on Windows

After the installation, don't forget to add the path to the directory where you chose to install Python to your PATH environment variable. This is important to be able to run the Python executable from any directory in the command line.

Python 2.4

Download and run the Python MSI installer: python-2.4.4.msi

Python 2.5

Simply download and install the appropriate .msi for your Python platform:

(Note that the Subversion project doesn't provide amd64 or ia64 setup executables, so if you want to use Subversion integration, you'll need to either compile the bindings yourself, or use the x86 version of Python).

Method 1: Using Installers

You need to download and install the following packages, pick the link appropriate to your Python version:

Mandatory Packages Installers
SetupTools setuptools-0.6c7.win32-py2.X.exe (2.5, 2.4, 2.3)
Genshi 0.5 Genshi-0.5.win32-X.exe (2.5, 2.4, 2.3)
Trac 0.11 trac-0.11.win32.exe (works for Python 2.3, 2.4 and 2.5)

Should that be Trac-0.11.1.win32.exe?

Should that be Genshi-0.5.1.win32-py2.5.exe?

http://genshi.edgewall.org/wiki/Download

 

Optional Packages Installers (see notes below)
PySqlite pysqlite-2.4.0.win32-py2.X.exe (2.5, 2.4, 2.3) (1)
Subversion svn-python-1.4.6.win32-py2.X.exe - (2.5, 2.4, 2.3) (2)
  svn-python-1.5.4.win32-py2.X.exe - (2.5)  
ClearSilver clearsilver-0.9.14.win32-py2.X.exe - (2.5, 2.4, 2.3) (3)

Notes:

  1. Pysqlite
    • If you're using Python 2.5, Trac is able to use the built-in sqlite3 module (same as Pysqlite 2.3.2), so you don't necessarily need to install that package.
    • If you plan to use another database than SQLite, installing Pysqlite is of course not needed. See the TracOnWindows/Advanced instructions for other options.

  1. Subversion
    • You don't necessarily need Subversion. You can use Trac with other versioning system backends or none at all.
    • If you need Subversion, the above links should be fine, unless you need to use Trac within Apache 2.2. In that case you need Apache 2.2 compatible binaries. But beware, this is a tricky install, as it seems that there exist various incompatibilities between the various released binaries (in particular, see ticket:6739#comment:9).
    • Try svn-python-1.5.2.win32-py2.5.exe if you have Subversion 1.5 and see the error like "Expected FS format '2'; found format '3'", 160043
  1. Clearsilver You only need Clearsilver if you're using a plugin that was not yet ported to Genshi.

 

Getting Started

Ok, now that Trac and all its requirements have been installed you can create your first project and try it out.

This example will create the projects in "C:\projects". This is a good default location, but you can put them in another drive or folder if you prefer.

Back to the command line:

md c:\projects
cd c:\projects

Optional: if you're using Trac with Subversion you can create a new repository for your source code:

md c:\projects\svn
svnadmin create c:\projects\svn\my-project

This step causes Subversion to create a subdirectory (c:\projects\svn\my-project) containing the basics of a Subversion project.

Initialize a new Trac project environment:

First go to the 'Scripts' folder in your Python install directory (e.g. "\Python25\Scripts"), and add the '.py' extension onto the files 'tracd' and 'trac-admin' if this is missing. Then, type the following at the command line:

md c:\projects\trac
c:\Python25\Scripts\trac-admin.exe c:\projects\trac\my-project initenv

Follow the interactive prompts to input information about your project. If you are unsure what to put you can simply press "Enter" to accept the default value.

Project Name [My Project]> 

Database connecting string [sqlite:db/trac.db]>

Repository type [svn]>

Path to repository [/path/to/repos]>

Template directory [C:\Python25\share\trac\templates]>

After this response, the script will say "Creating and Initializing Project". A large number of messages will scroll, finishing with "Congratulations!".

Note for Subversion users: when asked for the "Path to repository" input the folder of the repository you just created:

Path to repository [/path/to/repos]> c:/projects/svn/my-project

Note: be sure to include the full path, including the drive letter, and use forward slashes.

Try it out

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

From the command line, and in the [Python Install]\Scripts directory:

tracd-script.py -p 8000 c:\projects\trac\my-project

This exits with the following error on my system:

Usage: tracd-script.py [options] [projenv] ...

tracd-script.py: error: either the --env-parent-dir option or at least one environment must be specified

The following works, though:

tracd.exe -p 8000 c:\projects\trac\my-project

--- dummzeuch

Open your browser to http://localhost:8000 to test out your new Trac project. You should see the title "Welcome to Trac 0.11" in your browser, and in the command window from which you just launched tracd there will be a series of status log messages. These messages will continue to update as you move around the Trac site. When you are done, return to the command window from which you launched tracd and press Ctrl+Break to stop tracd.

Creating authentication with tracd on Windows (Standalone)

If you are running tracd without Apache, you can use this simple Python script to generate your passwords for tracd. Copy the contents below into a new file called 'C:\Python25\scripts\trac-digest.py'.

from optparse import OptionParser
import md5

# 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")
(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")
   
# Generate the string to enter into the htdigest file
realm = 'trac'
kd = lambda x: md5.md5(':'.join(x)).hexdigest()
print ':'.join((options.username, realm, kd([options.username, realm, options.password])))

You can create a new password file, or add new users to the file, by executing this command from the command line:

C:\Python25\Scripts\trac-digest.py -u "My User Name" -p my@user@password >> C:\projects\passwords.txt

To start tracd with authentication, execute this command from the command line:

C:\Python25\Scripts\tracd-script.py -p 8000 --auth=my-project,C:\projects\passwords.txt,trac c:\projects\trac\my-project

标签 :



发表评论 发送引用通报