【发布时间】:2021-04-26 21:12:31
【问题描述】:
我正在新的 RHEL 8 服务器上安装 Trac,并且在 httpd 错误日志中收到内部服务器错误:
ModuleNotFoundError: No module named 'trac'
我尝试使用
查看审核日志journal -xe | grep httpd
(并且还为 trac 和 apache 提供了 grep) - 以及那里显示的零错误信息。
httpd正常启动,没有错误。
Trac 被配置为使用 wsgi,它不是具有自己内置服务器的独立版本。 Apache HTTPD 应该是错误处理的。
这里是 httpd trac.conf 文件:
WSGIScriptAlias /trac /data/www/virtualhosts/trac/cgi-bin/trac.wsgi
<Location "/trac/login">
AuthType Basic
AuthName "Issue Tracker"
AuthUserFile /data/www/virtualhosts/trac/conf/trac.htpasswd
Require valid-user
</Location>
<Directory /data/www/virtualhosts/trac/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>
和 trac.wsgi
import os
def application(environ, start_request):
if not 'trac.env_parent_dir' in environ:
environ.setdefault('trac.env_path', '/data/www/virtualhosts/trac')
if 'PYTHON_EGG_CACHE' in environ:
os.environ['PYTHON_EGG_CACHE'] = environ['PYTHON_EGG_CACHE']
elif 'trac.env_path' in environ:
os.environ['PYTHON_EGG_CACHE'] = \
os.path.join(environ['trac.env_path'], '.egg-cache')
elif 'trac.env_parent_dir' in environ:
os.environ['PYTHON_EGG_CACHE'] = \
os.path.join(environ['trac.env_parent_dir'], '.egg-cache')
from trac.web.main import dispatch_request
return dispatch_request(environ, start_request)
python版本
[user@box] # python --version
Python 2.7.17
我不知道为什么我无法获得任何错误信息以显示在屏幕上或最好写入日志文件。这台服务器不是生产服务器,所以我现在可以在屏幕上显示一些东西。
非常感谢任何帮助
【问题讨论】:
-
我会尝试运行 TracStandalone 来验证您的 Trac 安装。此外,请检查
trac.wsgi的权限,并可能共享您的 Apache 站点文件内容。 -
trac.wsgi 应该是可执行的吗?目前 644
-
tracd 从命令行启动时没有错误,但我无法测试,因为端口 8080 在我的组织中的网络级别被阻止
-
是的,
trac.wsgi需要被 Apache 执行。 -
将 trac.wsgi 设置为可执行文件,重新启动 httpd 仍然得到
ModuleNotFoundError: No module named 'trac'
标签: apache error-handling httpd.conf internal-server-error trac