我刚刚使用Trac 1.0
安装了easy_install-2.6
的副本,但我无法破译Install documentation的“部署Trac”部分。
发出easy_install-2.6 Trac=1.0
后,我创建了我的环境:
trac-admin /www/virtualhosts/trac initenv
接下来,我设置权限:
chown -R apache.apache /www/virtualhosts/trac/
我的/etc/httpd/conf.d/trac.conf
文件如下所示:
<Location /trac>
SetHandler mod_python
PythonHandler trac.web.modpython_frontend
# "/www/virtualhosts/svn/trac" is the folder you gave to trac-admin initenv earlier
PythonOption TracEnv /www/virtualhosts/trac
# "/trac" is the same as the Location above
PythonOption TracUriRoot /trac
# "/tmp" should be some writable temporary directory
SetEnv PYTHON_EGG_CACHE /tmp
# "trac" can be any string, but must be the same for all
# Trac instances on the same Apache install
PythonInterpreter trac
</Location>
<Location /trac/login>
AuthType Basic
AuthName "Trac User"
AuthUserFile /www/virtualhosts/trac/conf/trac.htpasswd
Require valid-user
</Location>
我用:
重新加载了httpd配置service httpd reload
看到没有错误,我通过将浏览器指向http://my.site/trac/
来打开Trac安装。 Trac应用程序加载正常。
在文档中,有一节关于部署Trac 。这是我有点模糊的地方。我的trac安装是否尚未部署?或者这是一个额外的步骤?
其次,在映射静态资源下,文档说明了如何为两个目录设置别名:chrome和site。在 Apache ScriptAlias 示例的开头,文档提供了以下命令:
trac-admin /var/trac/env deploy /path/to/trac/htdocs/common
我的系统上没有/ var / trac / env。我找不到创建此目录的位置,除非它应该在初始安装Trac 1.0时设置。
有人可以解释创建chrome / site目录需要做些什么吗?我知道这些是Apache的别名,但我没有得到我上面引用的命令,其中trac-admin使用/ var / trac / env中的内容。该目录不存在,因此我无法发出该deploy命令。
我需要使用chrome / site别名才能安装插件。
答案 0 :(得分:4)
首先,不要使用mod_python。它不再被维护,它有一些已知的问题。 Setting up your server to use WSGI会为您提供更好的体验。
特别是关于deploy
命令,Trac文档确实可以更清楚一些。我相信这两个目录路径都只是占位符,并且与文档中使用的路径没有任何关系。它们仅仅是为了与其后面的配置文件示例中使用的路径相匹配。
根据您提供的信息以及我设置Trac系统时的注释,请尝试使用此命令:
trac-admin /www/virtualhosts/trac deploy /www/virtualhosts/trac/deploy
这应该在Trac目录中创建一个deploy
子目录,并用“cgi-bin”和“htdocs”子文件夹填充它。从那里,只需修改您的Apache配置文件,具体取决于您正在进行的部署类型(有关FastCGI和WSGI页面的详细信息)。
答案 1 :(得分:2)
/ var / trac / env 的意思是/path/to/trac-env
,在您的情况下转换为/www/virtualhosts/svn/trac
- 光盘上“Trac环境”的真实位置。
deploy
指令实际上创建了新目录并将静态内容提取到其中,Trac和你已经知道的Trac插件资源一样。每当您更新trac/htdocs
内容时,您都可以反复调用它。你甚至可以使用一个这样的trac/htdocs/common
用于由同一个Trac版本提供服务的多个Trac环境。只需确保检查目录权限以确保从Web服务器进程进行读取访问。
chrome/site
根本不是真正的目录,只是对目录<trac-env>/htdocs
的引用。
仍然有一些插件需要解压缩才能正常工作,所以你也需要setup a cache directory。