首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用wsgi设置trac

用wsgi设置trac
EN

Stack Overflow用户
提问于 2016-02-04 16:12:19
回答 2查看 1.5K关注 0票数 0

我遵循了以下步骤

  1. 斜交线1.0.9
  2. 使用python2.7 ./setup.py install安装。这是centos 6 64位上python的altinstall。
  3. trac-admin operationalintelligence initenv上创建存储库
  4. 试图设置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/可操作性情报”PythonOption TracUriRoot /usr/share/trac/可操作性情报“SetEnv PYTHON_EGG_CACHE /tmp PythonInterpreter trac”

Apache在尝试重新启动时失败。

使用下面的配置,我将收到以下错误

代码语言:javascript
复制
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配置,该配置正在进行中。

代码语言:javascript
复制
 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错误日志中收到的错误是

代码语言:javascript
复制
[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
EN

回答 2

Stack Overflow用户

发布于 2016-02-05 23:04:00

ModPython的问题似乎是因为mod_python没有被加载。尝试:

代码语言:javascript
复制
a2enmod mod_python

WSGI的问题在于Python路径上找不到Trac包。可能是权限问题。

票数 2
EN

Stack Overflow用户

发布于 2018-07-30 19:43:25

更改python文件的所有权有助于我:

代码语言:javascript
复制
chown -R wwwrun /usr/lib64/python2.7/site-packages
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35205990

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档