我已经在 Redhat 服务器中配置了 Django 1.4、mod_wsgi 2.0 和 apache 2.2.3。 但是当我尝试访问服务器时出现以下错误: “错误 500:内部服务器错误。”
[root@lts5srv1 hardi]# wget mritest.domain.ch
--2012-08-23 21:51:27-- http://mritest.domain.ch/
Resolving mritest.domain.ch... 127.0.0.1
Connecting to mritest.domain.ch|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2012-08-23 21:51:27 ERROR 500: Internal Server Error.
所以我有连接,但没有得到任何有效的响应。 这是否取决于 django 版本,我应该使用 Django 1.3 进行部署吗?
编辑
Apache 错误日志:
[Thu Aug 23 22:34:04 2012] [error] [client 127.0.0.1] mod_wsgi (pid=7835): Exception occurred processing WSGI script '/home/django_www/hello/apache/django.wsgi'.
[Thu Aug 23 22:34:04 2012] [error] Traceback (most recent call last):
[Thu Aug 23 22:34:04 2012] [error] File "/home/django_www/hello/apache/django.wsgi", line 1, in <module> [Thu Aug 23 22:34:04 2012] [error] import os
[Thu Aug 23 22:34:04 2012] [error] ImportError: No module named os"
最佳答案
mod_wsgi.so 是针对特定的 Python 版本编译的。如果您没有安装该版本,或者以其他方式强制它使用不同的 Python 版本,那么您可能会遇到此问题,而这是无法做到的。
弄清楚 mod_wsgi.so 是为哪个版本的 Python 编译的。
http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Shared_Library http://code.google.com/p/modwsgi/wiki/CheckingYourInstallation#Python_Installation_In_Use
所以首先要做的就是弄清楚 mod_wsgi.so 是针对什么编译的。
关于python - Django、mod_wsgi、 Apache : Internal server error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12099004/