为了让 mod_wsgi 在 CentOS 5.4 上运行,我按照此处的说明添加了 Python 2.6 作为可选库。配置看起来不错,除了尝试 ping 服务器时 Apache 日志打印此错误:
mod_wsgi (pid=20033, process='otalo', application='127.0.0.1|'): Loading WSGI script '...django.wsgi'.
[Sat Mar 27 16:11:45 2010] [error] [client 171.66.52.218] mod_wsgi (pid=20033): Target WSGI script '...django.wsgi' cannot be loaded as Python module.
[Sat Mar 27 16:11:45 2010] [error] [client 171.66.52.218] mod_wsgi (pid=20033): Exception occurred processing WSGI script '...django.wsgi'.
[Sat Mar 27 16:11:45 2010] [error] [client 171.66.52.218] Traceback (most recent call last):
[Sat Mar 27 16:11:45 2010] [error] [client 171.66.52.218] File "...django.wsgi", line 8, in <module>
[Sat Mar 27 16:11:45 2010] [error] [client 171.66.52.218] import django.core.handlers.wsgi
[Sat Mar 27 16:11:45 2010] [error] [client 171.66.52.218] ImportError: No module named django.core.handlers.wsgi
当我转到 python2.6 安装的命令行并尝试“导入 Django”时,找不到该模块(ImportError)。但是,我的默认 Python 2.4 安装(仍然可以正常工作)能够成功导入。如何将 Python 2.6 指向 Django?