我遇到的情況是有很多 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]
我用追蹤環境父目錄在 t1、t2 和 t3 上以及追蹤環境在 trac1/public 和 trac2/public 上
我想知道是否可以定義 url 變數的一部分。
答案1
您可能想切換到 mod_wsgi 而不是 modpython,並在此處查看我的答案如何執行您想要的操作:動態子域、mod_python 和 trac
答案2
有關將 Trac 與 mod_wsgi 整合的官方 mod_wsgi 文件告訴您如何執行此操作。看: