如何解决Python和Apache的WGSI问题?

时间:2015-09-21 21:31:31

标签: python django

我通过大学的工作继承了一个网站,我去了大约一到两周的关于Django如何使用Python的培训。一切都进展顺利,直到随机破坏。我的网页上出现500内部服务器错误。所以我去了日志,我得到了这个:

[Sun Sep 20 03:40:02 2015] [notice] Digest: generating secret for digest authentication ...
[Sun Sep 20 03:40:02 2015] [notice] Digest: done
[Sun Sep 20 03:40:02 2015] [notice] Apache/2.2.15 (Unix) DAV/2 mod_wsgi/4.4.10 Python/2.7.10 configured -- resuming normal operations
[Sun Sep 20 11:13:43 2015] [error] [client 140.118.21.88] mod_wsgi (pid=23683): Target WSGI script '/nfs/mohr/u1/rstone/www/design/apache/wsgi.py' cannot be loaded as Python module.
[Sun Sep 20 11:13:43 2015] [error] [client 140.118.21.88] mod_wsgi (pid=23683): Exception occurred processing WSGI script '/nfs/mohr/u1/rstone/www/design/apache/wsgi.py'.
[Sun Sep 20 11:13:43 2015] [error] [client 140.118.21.88] Traceback (most recent call last):
[Sun Sep 20 11:13:43 2015] [error] [client 140.118.21.88]   File "/nfs/mohr/u1/rstone/www/design/apache/wsgi.py", line 18, in <module>
[Sun Sep 20 11:13:43 2015] [error] [client 140.118.21.88]     application = get_wsgi_application()
[Sun Sep 20 11:13:43 2015] [error] [client 140.118.21.88]   File "/usr/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
[Sun Sep 20 11:13:43 2015] [error] [client 140.118.21.88]     django.setup()
[Sun Sep 20 11:13:43 2015] [error] [client 140.118.21.88]   File "/usr/lib/python2.7/site-packages/django/__init__.py", line 18, in setup

这时我意识到我对WGSI以及如何使用WGSI知之甚少。

我的wgsi.py看起来像这样:

import sys #; raise Exception(sys.path)
import os

path = '/nfs/mohr/u1/rstone/www/design'
if path not in sys.path:
    sys.path.append(path)

path = '/nfs/mohr/u1/rstone/www/'
if path not in sys.path:
    sys.path.append(path)

sys.path.append('/usr/lib/python2.7/site-packages/')


os.environ['DJANGO_SETTINGS_MODULE'] = 'design.settings'

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

同样,所有这一切都有效,直到我从一个周末回来,我得到500错误。我试着回到git中的先前版本,但也没有用,所以我认为它并不是网站破解它的代码。

如果我能够了解我应该去哪里,这将是很棒的。如何解决我没有造成的问题? 提前谢谢你能得到任何帮助。我仍然尽可能多地阅读,但如果我能得到一些很棒的建议。

0 个答案:

没有答案