gpt4 book ai didi

python - 部署 Django 应用程序时出现问题

转载 作者:太空宇宙 更新时间:2023-11-04 07:37:50 25 4
gpt4 key购买 nike

当我尝试访问 django 网站时出现“内部服务器错误”。我正在使用 Django 1.8、Python 2.7.10、centos 6.5 和 apache。

在 apache 日志中,我收到以下错误:

mod_wsgi (pid=23866): Target WSGI script '/abc/abc/abc/wsgi.py' cannot be loaded as Python module.
[Mon May 25 14:40:47 2015] [error] [client xyz] mod_wsgi (pid=23866): Exception occurred processing WSGI script '/abc/abc/abc/wsgi.py'.
[Mon May 25 14:40:47 2015] [error] [client xyz] Traceback (most recent call last):
[Mon May 25 14:40:47 2015] [error] [client xyz] File "/abc/abc/abc/wsgi.py", line 12, in <module>
[Mon May 25 14:40:47 2015] [error] [client xyz] from django.core.wsgi import get_wsgi_application
[Mon May 25 14:40:47 2015] [error] [client xyz] File "/abc/lib/python2.7/site-packages/django/__init__.py", line 1, in <module>
[Mon May 25 14:40:47 2015] [error] [client xyz] from django.utils.version import get_version
[Mon May 25 14:40:47 2015] [error] [client xyz] File "/abc/lib/python2.7/site-packages/django/utils/version.py", line 7, in <module>
[Mon May 25 14:40:47 2015] [error] [client xyz] from django.utils.lru_cache import lru_cache
[Mon May 25 14:40:47 2015] [error] [client xyz] File "/abc/lib/python2.7/site-packages/django/utils/lru_cache.py", line 28
[Mon May 25 14:40:47 2015] [error] [client xyz] fasttypes = {int, str, frozenset, type(None)},
[Mon May 25 14:40:47 2015] [error] [client xyz] ^
[Mon May 25 14:40:47 2015] [error] [client xyz] SyntaxError: invalid syntax

谢谢

最佳答案

虽然您说您运行的是 Python 2.7,但此错误表明您实际上使用的是 2.6,因为集合文字仅在 2.7 中引入。

问题是 mod_wsgi 是针对特定的 Python 版本编译的,在您的情况下是 Centos 6.5 附带的版本。您将需要为 2.7 重新编译它,或者找到一个已经针对它编译的版本。

关于python - 部署 Django 应用程序时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30444550/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com