【发布时间】:2013-08-30 07:50:20
【问题描述】:
我正在使用 mod_wsgi 运行 Django + httpd。
我已经阅读了文档并根据需要配置了 httpd.conf。我在 Centos5.5 上运行 Python2.7
我遇到了一个奇怪的“语法”错误,这对我来说似乎是版本冲突。有什么指点吗?
这是我的 Apache 错误日志:
[Tue Aug 27 19:12:01 2013] [error] [client 10.104.22.85] mod_wsgi (pid=32765): Target WSGI script '/home/sbose/PATH/TO/wsgi.py' cannot be loaded as Python module.
[Tue Aug 27 19:12:01 2013] [error] [client 10.104.22.85] mod_wsgi (pid=32765): Exception occurred processing WSGI script '/home/sbose/PATH/TO/wsgi.py'.
[Tue Aug 27 19:12:01 2013] [error] [client 10.104.22.85] Traceback (most recent call last):
[Tue Aug 27 19:12:01 2013] [error] [client 10.104.22.85] File "/home/sbose/PATH/TO/wsgi.py", line 10, in ?
[Tue Aug 27 19:12:01 2013] [error] [client 10.104.22.85] import django.core.handlers.wsgi
[Tue Aug 27 19:12:01 2013] [error] [client 10.104.22.85] File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 84
[Tue Aug 27 19:12:01 2013] [error] [client 10.104.22.85] self.buffer = b''
[Tue Aug 27 19:12:01 2013] [error] [client 10.104.22.85] ^
[Tue Aug 27 19:12:01 2013] [error] [client 10.104.22.85] SyntaxError: invalid syntax
更新: 我刚刚发现 Apache 正在运行 Python2.4 另外,仅供参考,我已经用 yum 安装了 mod_wsgi。
谢谢。
【问题讨论】:
-
重新检查回溯,问题可能出在那里
-
谢谢,我明白了。那不是我写的代码:-|
-
您可能想看看为什么会出现
Target WSGI script '/home/sbose/PATH/TO/wsgi.py' cannot be loaded as Python module错误。可能是this post ? -
谢谢,但是这个:“ImportError: No module named django.core.handlers.wsgi”显然不是我的情况:)
标签: python django apache mod-wsgi