我正在使用 Python 2.7 和 mod_python 3.3.1 以及 mod_wsgi 3.3。
我收到内部服务器错误,并且在 Apache 日志中有以下堆栈跟踪:
[Thu Apr 21 10:25:37 2011] [error] [client 83.244.243.242] import django.core.handlers.wsgi [Thu Apr 21 10:25:37 2011] [error] [client
83.244.243.242] ImportError: No module named django.core.handlers.wsgi [Thu Apr 21 10:25:37 2011] [error] [client
83.244.243.242] mod_wsgi (pid=4463): Target WSGI script '/home/one/codebase/campman/wsgi_handler.py' cannot be loaded as Python module. [Thu Apr 21 10:25:37 2011] [error] [client 83.244.243.242] mod_wsgi (pid=4463): Exception occurred processing WSGI script '/home/one/codebase/campman/wsgi_handler.py'. [Thu Apr 21 10:25:37 2011] [error] [client 83.244.243.242] Traceback (most recent call last): [Thu Apr 21 10:25:37 2011] [error] [client
83.244.243.242] File "/home/one/codebase/campman/wsgi_handler.py", line 13, in <module> [Thu Apr 21 10:25:37 2011] [error] [client
83.244.243.242] import django.core.handlers.wsgi [Thu Apr 21 10:25:37 2011] [error] [client
83.244.243.242] ImportError: No module named django.core.handlers.wsgi
答案1
您可能需要告诉您的 WSGI 处理程序在哪里寻找站点包:
import site
site.addsitedir('/path/to/lib/python2.7/site-packages')
答案2
听起来,您要托管的任何软件都依赖于并需要您安装 django 或一些支持 apache 的模块。请查看通过发行版的包管理器安装这些模块。
答案3
看着那(这WSGIPython可执行文件和 WSGIPythonPath apache 指令。
请注意 mod_python 和 mod_wsgi 是互斥的。