python - Django、mod_wsgi、 Apache : Internal server error

标签 python django apache mod-wsgi

我已经在 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/

相关文章:

python - '>' not supported between instances of ' int' 和 'NoneType' 。表单.is_valid

javascript - HTTP 文件下载 : Monitoring Download Progress

php: 无法对 php://input 执行多个 fread() 调用

python - 为 Python Twisted SOAP 服务器自动生成 WSDL 文件

python - Pandas concat 不能正确处理时间戳列?

python - Django 将单独的变量序列化为 json

apache - 如何将 Apache Solr 搜索与我的 Drupal 7 站点集成?

python - 如何测试 django 缓存?

python - 如何显示输入的数字在哪个位置?

Django Microsoft 身份验证后端在新部署中未成功