Django: settings.py bei wsgi-Konfiguration nicht gefundn
Verfasst: Samstag 17. Dezember 2011, 21:29
Hallo Forum,
ich bin hier gerade total verwirrt.
Irgendwie... finde ich den Fehler nicht. Also: das Django-Projekt funktioniert problemlos Development-Server. Ich wollte es dann entsprechend auf einen Apache testen und habe da Probleme mit dem Pfad... vielleicht.
Apache-Konfig:
Inhalt von /srv/www/django/src/django.wsgi:
Wenn ich diese Datei direkt ausführe (also mit python django.wsgi) Bekomme ich folgende Ausgabe:
Offensichtlich scheint das also grundsätzlich zu funktionieren was das importieren angeht.
Wenn ich aber jetzt im Apache die Webseite ansurfe gibt es Fehler und folgende Ausgabe im Error-Log des Apache:
Ich finde hier meinen Denkfehler einfach nicht... 
Gruß
Sparrow
ich bin hier gerade total verwirrt.
Irgendwie... finde ich den Fehler nicht. Also: das Django-Projekt funktioniert problemlos Development-Server. Ich wollte es dann entsprechend auf einen Apache testen und habe da Probleme mit dem Pfad... vielleicht.
Apache-Konfig:
Code: Alles auswählen
<VirtualHost *:80>
LogLevel warn
WSGIScriptAlias / /srv/www/django/src/django.wsgi
Alias /static /srv/www/django/static
</VirtualHost>
Code: Alles auswählen
import os, sys
path = "/srv/www/django/src/ra"
if path not in sys.path:
sys.path.append(path)
import ra
import ra.settings
print ra.settings
os.environ['DJANGO_SETTINGS_MODULE'] = 'ra.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
Code: Alles auswählen
<module 'ra.settings' from '/srv/www/django/src/ra/settings.pyc'>
Wenn ich aber jetzt im Apache die Webseite ansurfe gibt es Fehler und folgende Ausgabe im Error-Log des Apache:
Code: Alles auswählen
[Sat Dec 17 21:28:19 2011] [error] [client 192.168.1.55] mod_wsgi (pid=2016): Target WSGI script '/srv/www/django/src/django.wsgi' cannot be loaded as Python module.
[Sat Dec 17 21:28:19 2011] [error] [client 192.168.1.55] mod_wsgi (pid=2016): Exception occurred processing WSGI script '/srv/www/django/src/django.wsgi'.
[Sat Dec 17 21:28:19 2011] [error] [client 192.168.1.55] Traceback (most recent call last):
[Sat Dec 17 21:28:19 2011] [error] [client 192.168.1.55] File "/srv/www/django/src/django.wsgi", line 5, in <module>
[Sat Dec 17 21:28:19 2011] [error] [client 192.168.1.55] import ra
[Sat Dec 17 21:28:19 2011] [error] [client 192.168.1.55] ImportError: No module named ra

Gruß
Sparrow