2016-10-15 3 views
1

Ich bekomme einen seltsamen Fehler beim Versuch, meine Django-Site unter Apache mit mod_wsgi ausführen. Ich habe stundenlang daran gearbeitet, ohne Erfolg.Syntax Fehler mit Django, WSGI und Apache

FYI: Ich benutze auch Mezzanine.

Log:

[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30] mod_wsgi (pid=15554): Target WSGI script '/opt/mysite/mysite/wsgi.py' cannot be loaded as Python module. 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30] mod_wsgi (pid=15554): Exception occurred processing WSGI script '/opt/mysite/mysite/wsgi.py'. 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30] Traceback (most recent call last): 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30] File "/opt/mysite/mysite/wsgi.py", line 12, in <module> 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30]  from django.core.wsgi import get_wsgi_application 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30] File "/usr/lib/python2.6/site-packages/django/__init__.py", line 3, in <module> 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30]  from django.utils.version import get_version 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30] File "/usr/lib/python2.6/site-packages/django/utils/version.py", line 7, in <module> 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30]  from django.utils.lru_cache import lru_cache 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30] File "/usr/lib/python2.6/site-packages/django/utils/lru_cache.py", line 28 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30]  fasttypes = {int, str, frozenset, type(None)}, 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30]     ^
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30] SyntaxError: invalid syntax 

httpd.conf für mysite (es gibt auch andere auf dem Server)

# Redirects all HTTP traffic to HTTPS 
<VirtualHost *:80> 
    #ServerName test-mysite 
    #ServerAlias test-mysite mysite.com mysite 
    ServerName mysite.com 
    ServerAlias mysite test-mysite.com test-mysite 

    DocumentRoot /opt/mysite 

    RewriteEngine On 
    RewriteCond %{HTTPS} off 
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 

    WSGIScriptAlias//opt/mysite/mysite/wsgi.py 

</VirtualHost> 

WSGISocketPrefix /var/run/wsgi 

<VirtualHost *:443> 
    #ServerName test-mysite.com 
    #ServerAlias test-mysite 
    ServerName mysite.com 
    ServerAlias mysite test-mysite.com test-mysite 
    ErrorLog /var/log/httpd/ssl_mysite_error_log 
    CustomLog /var/log/httpd/ssl_mysite_request_log \ 
       "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b" 
    TransferLog /var/log/httpd/ssl_mysite_access_log 
    LogLevel warn 

    WSGIDaemonProcess mysite.com processes=2 threads=15 display-name=%{GROUP} 
    WSGIProcessGroup mysite.com 

    WSGIScriptAlias//opt/mysite/mysite/wsgi.py 

    <Directory /opt/mysite/mysite> 
     Options +FollowSymLinks -Indexes 
     AllowOverride All 
     order allow,deny 
     allow from all 
    </Directory> 

    SSLEngine On 
    SSLProtocol all -SSLv2 
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW 
    SSLCertificateFile /etc/pki/tls/certs/othersite_com.crt 
    SSLCertificateKeyFile /etc/pki/tls/private/othersite.com.key 
    SSLCertificateChainFile /etc/pki/tls/certs/DigiCertCA.crt 
</VirtualHost> 

httpd -V Ausgang:

Server version: Apache/2.2.15 (Unix) 
Server built: Jul 12 2016 07:03:49 
Server's Module Magic Number: 20051115:25 
Server loaded: APR 1.3.9, APR-Util 1.3.9 
Compiled using: APR 1.3.9, APR-Util 1.3.9 
Architecture: 64-bit 
Server MPM:  Prefork 
    threaded:  no 
    forked:  yes (variable process count) 
Server compiled with.... 
-D APACHE_MPM_DIR="server/mpm/prefork" 
-D APR_HAS_SENDFILE 
-D APR_HAS_MMAP 
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) 
-D APR_USE_SYSVSEM_SERIALIZE 
-D APR_USE_PTHREAD_SERIALIZE 
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT 
-D APR_HAS_OTHER_CHILD 
-D AP_HAVE_RELIABLE_PIPED_LOGS 
-D DYNAMIC_MODULE_LIMIT=128 
-D HTTPD_ROOT="/etc/httpd" 
-D SUEXEC_BIN="/usr/sbin/suexec" 
-D DEFAULT_PIDLOG="run/httpd.pid" 
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status" 
-D DEFAULT_LOCKFILE="logs/accept.lock" 
-D DEFAULT_ERRORLOG="logs/error_log" 
-D AP_TYPES_CONFIG_FILE="conf/mime.types" 
-D SERVER_CONFIG_FILE="conf/httpd.conf" 

Wie kann ich dieses Problem beheben?

Antwort

2
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30] File "/usr/lib/python2.6/site-packages/django/utils/lru_cache.py", line 28 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30]  fasttypes = {int, str, frozenset, type(None)}, 
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30]     ^
[Fri Oct 14 23:48:13 2016] [error] [client 128.187.3.30] SyntaxError: invalid syntax 

Python 2.6 nicht set Syntax {....}

Sie use a version of Django that supports Python 2.6 unterstützt kann aber stellen Sie sicher, es unterstützt auch Mezzanine OR Aktualisieren Sie Ihre Python-Installation 2.7