我正在尝试让readthedocs作为apache应用程序运行。我遵循了所有的说明,但我把它归结为我的apache日志中的这个错误。
mod_wsgi (pid=2372): Target WSGI script '/opt/readthedocs.org/readthedocs/wsgi.py' cannot be loaded as Python module.
mod_wsgi (pid=2372): Exception occurred processing WSGI script '/opt/readthedocs.org/readthedocs/wsgi.py'.
Traceback (most recent call last):
File "/opt/readthedocs.org/readthedocs/wsgi.py", line 8, in <module>
from django.core.wsgi import get_wsgi_application
File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "/usr/local/lib/python2.7/site-packages/django/utils/version.py", line 7, in <module>
from django.utils.lru_cache import lru_cache
File "/usr/local/lib/python2.7/site-packages/django/utils/lru_cache.py", line 28
fasttypes = {int, str, frozenset, type(None)},
^
SyntaxError: invalid syntax我不太了解这个系统,不知道我是否应该搜索服务器配置错误,或者我是否正在处理应用程序的这个分支中的错误。
我一直在遵循这些说明,因为这是在专用服务器上进行的,所以我没有使用虚拟环境
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/modwsgi/
https://read-the-docs.readthedocs.org/en/latest/install.html
我的包文件夹:
alabaster django_filters lazr.uri-1.0.3-nspkg.pth pytz-2013b0.egg-info
alabaster-0.7.6.dist-info django_formtools-1.0.dist-info livereload queries
allauth django_gravatar livereload-2.4.0.dist-info README
amqp django_gravatar2-1.0.6.egg-info markdown recommonmark
amqp-1.4.6.dist-info django_guardian-1.3.egg-info Markdown-2.6.2.dist-info recommonmark-0.1.1.dist-info
anyjson django_haystack-2.1.0.egg-info mimeparse-0.1.3.egg-info redis
anyjson-0.3.3.egg-info django_kombu-0.9.4.egg-info mimeparse.py redis-2.7.1.egg-info
appconf django_pagination-1.0.7.egg-info mimeparse.pyc requests
babel djangorestframework-3.0.4.dist-info mkdocs requests-2.3.0.dist-info
Babel-2.0.egg-info djangosecure mkdocs-0.14.0.dist-info requests_oauthlib
beautifulsoup4-4.1.3.egg-info django_secure-0.1.2.egg-info mock-1.0.1.egg-info requests_oauthlib-0.5.0.dist-info
bs4 django_taggit-0.17.1.egg-info mock.py rest_framework
celery django_tastypie-0.12.2.dev0.egg-info mock.pyc slumber
celery-3.1.18.dist-info djcelery nilsimsa slumber-0.6.0.dist-info
celery_haystack djcelery_transactions nilsimsa-0.3.7.egg-info snowballstemmer
celery_haystack-0.7.2.egg-info djkombu oauth snowballstemmer-1.2.0.egg-info
certifi dns oauth-1.0.1.egg-info sphinx
certifi-2015.9.6.2.dist-info dnspython-1.11.0.egg-info oauthlib Sphinx-1.3.1.dist-info
click doc2dash oauthlib-1.0.3.egg-info sphinx_http_domain
click-5.1.dist-info doc2dash-1.1.0.egg-info openid sphinx_http_domain-0.2.egg-info
CommonMark docker packaging sphinx_rtd_theme
CommonMark-0.5.4.egg-info docker_py-1.3.1.egg-info packaging-15.2.dist-info sphinx_rtd_theme-0.1.8.dist-info
copyright easy-install.pth pagination stripe
corsheaders elasticsearch pip stripe-1.20.2.egg-info
cssselect elasticsearch-1.5.0.dist-info pip-7.1.0.dist-info taggit
cssselect-0.9.1.egg-info formtools py tastypie
ddf_setup guardian py-1.4.30.dist-info test
distutils2 haystack pyelasticsearch testresources
Distutils2-1.0a3.egg-info httplib2 pyelasticsearch-0.7.1.egg-info testresources-0.2.7.egg-info
django httplib2-0.7.7.egg-info pygments unipath
Django-1.8.3.dist-info keyring Pygments-2.0.2.dist-info Unipath-0.2.1.egg-info
django_allauth-0.21.0.egg-info keyring-5.4.egg-info pyquery VERSION
django_appconf-1.0.1.dist-info kombu pyquery-1.2.2.egg-info virtualenv-13.1.0.dist-info
django_celery-3.1.16.dist-info kombu-3.0.26.dist-info _pytest virtualenv.py
django_celery_transactions-0.3.2.egg-info launchpadlib pytest-2.7.2.dist-info virtualenv.pyc
django_copyright-1.0.0.egg-info launchpadlib-1.10.2.egg-info pytest_django virtualenv_support
django_cors_headers-0.13.egg-info lazr pytest_django-2.8.0.dist-info wadllib
django_dynamic_fixture lazr.authentication-0.1.3.egg-info pytest.py wadllib-1.3.2.egg-info
django_dynamic_fixture-1.8.5.egg-info lazr.authentication-0.1.3-nspkg.pth pytest.pyc websocket
django_extensions lazr.restfulclient-0.13.1.egg-info python_mimeparse-0.1.4.egg-info websocket_client-0.32.0.egg-info
django_extensions-1.3.8.dist-info lazr.restfulclient-0.13.1-nspkg.pth python_openid-2.2.5.egg-info wsgi_intercept
django_filter-0.11.0.egg-info lazr.uri-1.0.3.egg-info pytz wsgi_intercept-0.10.3.egg-info发布于 2015-09-14 01:31:44
当编译 mod_wsgi 时使用的Python版本与正在使用的版本不兼容时,通常会出现此错误。
看起来你使用的是Django 1.8。现在,Django 1.8兼容Python 2.7或更高版本。显然,用于编译mod_wsgi的Python版本低于2.7。
mod_wsgi包针对特定的Python版本进行编译,并通过共享库进行链接。
从mod_wsgi文档中:
在构建
mod_wsgi时,应该通过共享库将'mod_wsgi.so'文件与Python链接起来。如果不是这样,并且它被链接到一个静态库上,就会出现各种问题。
你需要做什么?
你需要检查你的mod_wsgi是用哪个Python版本编译的。如果mod_wsgi所链接的Python版本低于2.7,则需要使用Python versions>= 2.7重新编译mod_wsgi。
如何检查mod_wsgi 编译的Python版本?
您可以尝试运行ldd命令并检查输出。
示例输出:
$ ldd mod_wsgi.so
linux-vdso.so.1 => (0x00007fffeb3fe000)
libpython2.5.so.1.0 => /usr/local/lib/libpython2.5.so.1.0 (0x00002adebf94d000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00002adebfcba000)
libdl.so.2 => /lib/libdl.so.2 (0x00002adebfed6000)
libutil.so.1 => /lib/libutil.so.1 (0x00002adec00da000)
libc.so.6 => /lib/libc.so.6 (0x00002adec02dd000)
libm.so.6 => /lib/libm.so.6 (0x00002adec0635000)
/lib64/ld-linux-x86-64.so.2 (0x0000555555554000)此外,这是用于检查mod_wsgi安装的official link。
https://stackoverflow.com/questions/32552289
复制相似问题