Apache mod_wsgi错误:ImportError:没有名为django.core.handlers.wsgi的模块

我正在使用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 

您可能需要告诉您的WSGI处理程序在哪里查找站点包:

 import site site.addsitedir('/path/to/lib/python2.7/site-packages') 

听起来就像你试图托pipe的软件取决于和需要你安装django或它的一些支持模块的Apache。 看看通过你的发行版的包pipe理器安装这些。

看看WSGIPythonExecutable和WSGIPythonPath apache指令。

请注意,mod_python和mod_wsgi是互斥的。