0
我按照以下步驟設立的trac與WSGI
- 立即下載TRAC 1.0.9
- 安裝使用
python2.7 ./setup.py install
。這是蟒蛇在CentOS一個altinstall 6 64位 - 創建存儲庫上
trac-admin operationalintelligence initenv
- 試圖設置Apache,但不工作
我已經SELinux的啓用並運行chcon -R -t httpd_sys_content_t /usr/share/trac
< Location /trac/operationalintelligence > SetHandler mod_python PythonHandler trac.web.modpython_frontend PythonOption TracEnv "/usr/share/trac/operationalintelligence" PythonOption TracUriRoot "/usr/share/trac/operationalintelligence" SetEnv PYTHON_EGG_CACHE /tmp PythonInterpreter trac </Location>
嘗試重新啓動時Apache失敗。
與以下配置我正在recieving下面
Invalid command 'PythonInterpreter', perhaps misspelled or defined by a module not included in the server configuration
#Alias /trac /usr/share/trac/operationalintelligence
#<Directory /usr/share/trac/operationalintelligence>
# SetHandler mod_python
# PythonInterpreter main_interpreter
# PythonHandler trac.web.modpython_frontend
# PythonOption TracEnv /usr/share/trac/operationalintelligence
# PythonOption TracUriRoot /trac
#</Directory>
的錯誤,現在我已經試過WSGI配置其進展
WSGIScriptAlias /trac /usr/share/trac/operationalintelligence/cgi-bin/trac.wsgi
<Directory /usr/share/trac/operationalintelligence/cgi-bin>
WSGIApplicationGroup %{GLOBAL}
# For Apache 2.2
<IfModule !mod_authz_core.c>
Order deny,allow
Allow from all
</IfModule>
# For Apache 2.4
<IfModule mod_authz_core.c>
Require all granted
</IfModule>
</Directory>
我收到的httpd錯誤日誌中的錯誤是
[Thu Feb 04 17:40:52 2016] [error] [client 47.73.16.6] mod_wsgi (pid=30558): Exception occurred processing WSGI script '/usr/share/trac/operationalintelligence/cgi-bin/trac.wsgi'.
[Thu Feb 04 17:40:52 2016] [error] [client 47.73.16.6] Traceback (most recent call last):
[Thu Feb 04 17:40:52 2016] [error] [client 47.73.16.6] File "/usr/share/trac/operationalintelligence/cgi-bin/trac.wsgi", line 30, in application
[Thu Feb 04 17:40:52 2016] [error] [client 47.73.16.6] from trac.web.main import dispatch_request
[Thu Feb 04 17:40:52 2016] [error] [client 47.73.16.6] ImportError: No module named trac.web.main
[Thu Feb 04 17:40:58 2016] [error] [client 47.73.16.6] mod_wsgi (pid=30553): Exception occurred processing WSGI script '/usr/share/trac/operationalintelligence/cgi-bin/trac.wsgi'.
[Thu Feb 04 17:40:58 2016] [error] [client 47.73.16.6] Traceback (most recent call last):
[Thu Feb 04 17:40:58 2016] [error] [client 47.73.16.6] File "/usr/share/trac/operationalintelligence/cgi-bin/trac.wsgi", line 30, in application
[Thu Feb 04 17:40:58 2016] [error] [client 47.73.16.6] from trac.web.main import dispatch_request
[Thu Feb 04 17:40:58 2016] [error] [client 47.73.16.6] ImportError: No module named trac.web.main
^C
如果您安裝Trac系統作爲非root用戶,那麼它可能已經被安裝到用戶指定的Python的目錄,你的網絡服務器(運行作爲一個單獨的用戶)不能訪問它。如果這確實是問題,那麼以超級用戶身份安裝Trac應該解決它。 – bta
我已經使用root用戶,我使用的是centos。我使用'python setup install'命令安裝了trac,因此trac文件夾位於哪裏chmod? – shorif2000
這取決於你的Linux發行版和Python版本,但你可能有:'在/ usr/bin中/ tracd','在/ usr/bin中/ TRAC-admin'和'/usr/lib/python2.7/dist-packages/ trac'。你也可以查看'/ usr/local/lib/python2.7/site-packages'和'/ usr/local/lib/python2.7/dist-packages'。 – RjOllos