我在mod_wsgi上安装了带Virtualenv的Django 1.11.5。
python版本是2.7.13。
我在/var/log/httpd/error_log
中收到此错误:
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] mod_wsgi (pid=9606): Target WSGI script '/var/www/html/memit/memit/wsgi.py' cannot be loaded as Python module.
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] mod_wsgi (pid=9606): Exception occurred processing WSGI script '/var/www/html/memit/memit/wsgi.py'.
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] Traceback (most recent call last):
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] File "/var/www/html/memit/memit/wsgi.py", line 13, in <module>
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] from django.core.wsgi import get_wsgi_application
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] File "/var/www/html/memit/env/lib/python2.7/site-packages/django/__init__.py", line 3, in <module>
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] from django.utils.version import get_version
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] File "/var/www/html/memit/env/lib/python2.7/site-packages/django/utils/version.py", line 7, in <module>
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] from django.utils.lru_cache import lru_cache
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] File "/var/www/html/memit/env/lib/python2.7/site-packages/django/utils/lru_cache.py", line 28
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] fasttypes = {int, str, frozenset, type(None)},
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] ^
[Wed Sep 13 16:41:00 2017] [error] [client 5.125.70.26] SyntaxError: invalid syntax
我的Apache虚拟主机是:
<VirtualHost *:80>
ServerName memit.ir
ServerAlias www.memit.ir
DocumentRoot /var/www/html/memit
WSGIDaemonProcess memit python-path=/var/www/html/memit:/var/www/html/memit/env/lib/python2.7/site-packages
WSGIProcessGroup memit
WSGIScriptAlias / /var/www/html/memit/memit/wsgi.py
<Directory /var/www/html/memit>
Allow from all
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>
有什么问题?
如何解决这个问题?