Keine solche Datei oder Verzeichnis: mod_wsgi

327
Terri Simon

Mein Apache scheint gut zu laufen, abgesehen von zwei Dingen.

1) Nachricht in error.log:

[wsgi:warn] [pid 1234:tid 12345678] (2)No such file or directory: mod_wsgi (pid=1234): Unable to stat Python home /home/user/myproject/myprojectenv:/home/user/myproject/myprojectenv/myproject. Python interpreter may not be able to be initialized correctly. Verify the supplied path and access permissions for whole of the path. 
  1. Wenn ich versuche, die Adresse 127.0.0.1:8181 im Browser aufzurufen, erhalte ich die Meldung 403 Forbidden.

Ich arbeite unter Ubuntu 14.04, Apache 2.4.7, Python 3.6.1 und Django. Ich habe das mod_wsgi mit der richtigen Version von Python (Shared Library) kompiliert. Das Verzeichnis / home / user verfügt über die Berechtigung 755, und von myproject down ist alles auf 775 eingestellt.

Beachten Sie, dass unser Benutzername "Benutzer" ist und die virtuelle Umgebung myprojectenv ist.

Code-Snippet aus der Datei apache2.conf:

IncludeOptional mods-enabled/*.load IncludeOptional mods-enabled/*.conf Include ports.conf  <Directory /> Options FollowSymLinks AllowOverride None Require all denied </Directory>  <Directory /usr/share> AllowOverride None Require all granted </Directory>  <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory>  <Directory /home/user/myproject/projectenv/myproject/myapp> <Files wsgi.py> Require all granted </Files> </Directory>  IncludeOptional sites-enabled/*.conf IncludeOptional conf-enabled/*.conf 

Von 000-default.conf:

<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html ErrorLog $/error.log CustomLog $/access.log combined </VirtualHost> <VirtualHost *:8181> ServerName localhost ServerAlias localhost ServerAdmin webmaster@localhost DocumentRoot /home/user/myproject/myprojectenv/myproject ErrorLog $/error.log CustomLog $/access.log combined  Alias /static/ /home/user/myproject/myprojectenv/myproject/myproject_static/ <Directory /home/user/myproject/myprojectenv/myproject/myproject_static> Require all granted </Directory> <Directory /home/user/myproject/myprojectenv/myproject/myapp> <Files wsgi.py> Require all granted </Files> </Directory>  WSGIDaemonProcess myproject user=user home=/home/user/myproject/myprojectenv/lib/python3.6 python=path=/home/user/myproject/myprojectenv/myproject python-home=/home/user/myproject/myprojectenv:/home/user/myproject/myprojectenv/myproject WSGIProcessGroup myproject WSGIApplicationGroup localhost:8181 WSGIScriptAlias /home/user/myproject/myprojectenv/myproject /home/user/myproject/myprojectenv/myproject/myapp/wsgi.py </VirtualHost> 

In der base.ini-Datei unseres Projekts haben wir Folgendes:

[web_server] host = 127.0.0.1 port = 8181 url = http://$:$/ 

Die ports.conf-Datei enthält 80 und 8181.

Ich weiß, dass es irgendwo eine Trennung gibt, aber ich weiß nicht wo. Alle Hinweise wären großartig. Vielen Dank.

0

0 Antworten auf die Frage