路由 Apache TracEnv

路由 Apache TracEnv

我遇到了许多 trac 实例的情况。它们在文件系统中都具有相同的结构。

PATH/trac1
PATH/trac2
PATH/trac3

我有这个配置

<Location /trac/trac1>
 SetHandler mod_python
 PythonInterpreter main_interpreter
 PythonHandler trac.web.modpython_frontend 
 PythonOption TracEnv PATH/trac1
 PythonOption TracUriRoot /trac/trac1
 PythonOption PYTHON_EGG_CACHE PATH/eggs/
</Location>
<Location /trac/trac2>
 SetHandler mod_python
 PythonInterpreter main_interpreter
 PythonHandler trac.web.modpython_frontend 
 PythonOption TracEnv PATH/trac2
 PythonOption TracUriRoot /trac/trac2
 PythonOption PYTHON_EGG_CACHE PATH/eggs/
</Location>
<Location /trac/trac3>
 SetHandler mod_python
 PythonInterpreter main_interpreter
 PythonHandler trac.web.modpython_frontend 
 PythonOption TracEnv PATH/trac3
 PythonOption TracUriRoot /trac/trac3
 PythonOption PYTHON_EGG_CACHE PATH/eggs/
</Location>

我想知道是否有可能做类似的事情(TracEnvParentDir 不是一个选项

<Location /trac/{ENV}>
 SetHandler mod_python
 PythonInterpreter main_interpreter
 PythonHandler trac.web.modpython_frontend 
 PythonOption TracEnv PATH/{ENV}
 PythonOption TracUriRoot /trac/{ENV}
 PythonOption PYTHON_EGG_CACHE PATH/eggs/
</Location>

感谢您的时间。

编辑:TracEnvParentDir 不是一个选项,因为我的结构如下

+---projs
    +---trac1
    ¦   +---public [instance]
    ¦   +---t1
    ¦   ¦   +---common [instance]
    ¦   ¦   +---g1 [instance]
    ¦   ¦   +---g2 [instance]
    ¦   ¦   +---g3 [instance]
    ¦   ¦   +---g4 [instance]
    ¦   ¦   +---g5 [instance]
    ¦   +---t2
    ¦   ¦   +---common [instance]
    ¦   ¦   +---g1 [instance]
    ¦   ¦   +---g2 [instance]
    ¦   ¦   +---g3 [instance]
    ¦   ¦   +---g4 [instance]
    ¦   ¦   +---g5 [instance]
    ¦   +---t3
    ¦       +---common [instance]
    ¦       +---g1 [instance]
    ¦       +---g2 [instance]
    ¦       +---g3 [instance]
    ¦       +---g4 [instance]
    ¦       +---g5 [instance]
    ¦  
    +---trac2
        +---public [instance]
        +---t1
        ¦   +---common [instance]
        ¦   +---g1 [instance]
        ¦   +---g2 [instance]
        ¦   +---g3 [instance]
        ¦   +---g4 [instance]
        ¦   +---g5 [instance]
        +---t2
        ¦   +---common [instance]
        ¦   +---g1 [instance]
        ¦   +---g2 [instance]
        ¦   +---g3 [instance]
        ¦   +---g4 [instance]
        ¦   +---g5 [instance]
        +---t3
            +---common [instance]
            +---g1 [instance]
            +---g2 [instance]
            +---g3 [instance]
            +---g4 [instance]
            +---g5 [instance]

我用TracEnvParentDir在 t1、t2 和 t3 上跟踪环境在 trac1/public 和 trac2/public 上

我想知道是否可以定义 url 变量的一部分。

答案1

您可能想要切换到 mod_wsgi 而不是 modpython,然后在此处查看我的回答以了解如何执行您想要的操作:动态子域名、mod_python 和 trac

答案2

有关如何将 Trac 与 mod_wsgi 集成的官方 mod_wsgi 文档将告诉您如何执行此操作。请参阅:

http://code.google.com/p/modwsgi/wiki/IntegrationWithTrac

相关内容