ImportError: Kein Modul namens django.core.handlers.wsgi bei der Installation von django mod_wsgi config auf apache

Ich habe versucht, django zu installieren, um mit Apache und mod_wsgi zu arbeiten, erhalte aber diesen Fehler:

ImportError: No module named django.core.handlers.wsgi,

Ich habe gelesen, dass es Benutzerfehler sein kann ...

Auf der Konsole (ssh) habe ich mit Root-Zugriff keine Probleme, auf django.core.handlers.wsgi zuzugreifen, aber wenn Apache danach fragt, kann er nicht

My django.wsgi:

import os
import sys

sys.path.append('my/rep/parents/of/my/project')
sys.path.append('/usr/lib/python2.4/site-packages/django')
os.environ['DJANGO_SETTINGS_MODULE'] = 'montest.settings'
os.environ['PYTHON_EGG_CACHE'] = '/tmp'


import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Meine vhost.conf:

Alias /media/ my/rep/parents/of/my/projet/montest/media/

<Directory my/rep/parents/of/my/projet/montest/media>
    Order deny,allow
    Allow from all
</Directory>

WSGIScriptAlias /montest my/rep/parents/of/my/projet/django.wsgi

<Directory my/rep/parents/of/my/projet>
    Order deny,allow
    Allow from all
</Directory>

EDIT:

Ok mein Ergebnis für ldd mod_wsgi.so

linux-gate.so.1 => (0x0013c000) 
libpython2.6.so.1.0 => /usr/lib/libpython2.6.so.1.0 (0x00663000) 
libpthread.so.0 => /lib/libpthread.so.0 (0x00bff000) 
libdl.so.2 => /lib/libdl.so.2 (0x0023b000) 
libutil.so.1 => /lib/libutil.so.1 (0x00420000) 
libm.so.6 => /lib/libm.so.6 (0x00110000) 
libc.so.6 => /lib/libc.so.6 (0x00240000) /lib/ld-linux.so.2 (0x0059f000) 

So entscheide ich mich, meine mod_wsgi-Installation mit der test.wsgi zu testen

test.wsgi

def application(environ, start_response): 
    status = '200 OK'
    output = 'Hello world, I am a wsgi app!' 
    response_headers = [('Content-Type', 'text/plain'), ('Content-Length', str(len(output)))] 
    start_response(status, response_headers) 
    return [output]

my vhost.conf:

WSGIScriptAlias /test /var/www/vhosts/mydomain.fr/subdomains/django/httpdocs/test.wsgi 
<Directory /var/www/vhosts/mydomain.fr/subdomains/django/httpdocs> 
    Order allow,deny 
    Allow from all 
    Options +ExecCGI 
</Directory> 

Es funktioniert jetzt ... als nächstes werde ich meine django.wsgi-Konfiguration ausprobieren

Antworten auf die Frage(20)

Ihre Antwort auf die Frage