2017-09-24 2 views
-1

Ich möchte Open Django Server mit Apache und mod_wsgi. i schrieb sich wie folgtdjango apache wsgi ausgabe

sudo apt-get install apache2 
sudo apt-get install libapache2-mod-wsgi 

und django Projekt und App erstellen, und ich meine bot in setting.py hinzufügen und virtuelle Umgebung erstellen und mit und unter Code hinzufügen in seoultech/wsgi.py/django = mydirctory/seoultech = Projekt/bot = app/

import os, sys 

sys.path.append('/home/django') 
sys.path.append('/home/django/venv/lib/python2.7/site-packages') 

from django.core.wsgi import get_wsgi_application 

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "seoultech.settings") 

application = get_wsgi_application() 

und cd /etc/apache2/site-available/000-default.conf add Code

WSGIDaemonProcess seoultech python-path=/home/django/seoultech=home/django 
/venv/lib/python2.7/site-packages 
<VirtualHost *:80> 

    ServerAdmin [email protected] 
    WSGIScriptAlias//home/django/seoultech/wsgi.py 


<Directory /home/django/seoultech> 
    <Files wsgi.py> 
     Require all granted 
    </Files> 
</Directory 
</VirtualHost> 

aber sudo apachectl-k Start bekam ich Fehler

'AH00526: Syntax error on line 1 of /etc/apache2/sites-enabled 
/000default.conf:Invalid command 'WSGIDaemonProcess', perhaps misspelled 
or defined by a module not included in the server configuration Action '-k 
start' failed.The Apache error log may have more information.' 

im freute

+0

Nachdem Sie richtig mod_wsgi laden/aktivieren, da der Fehler ist das Problem gibt, sind Sie eine '' WSGIProcessGroup'' Richtlinie und konfigurieren nicht richtig virtuelle Umgebung Python. Siehe http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html –

Antwort

0

Platz WSGIDaemonProcess innerhalb von Virtualhost zu helfen, diesem Fehler loszuwerden.

<VirtualHost *:80> 

    ServerAdmin [email protected] 

    WSGIDaemonProcess seoultech python-path=/home/django/seoultech=home/django 
/venv/lib/python2.7/site-packages 
    WSGIScriptAlias//home/django/seoultech/wsgi.py 


<Directory /home/django/seoultech> 
    <Files wsgi.py> 
     Require all granted 
    </Files> 
</Directory 
</VirtualHost> 
+0

Ich habe denselben Fehler ... helft mir –

+0

sudo a2enmod wsgi? –

+0

FEHLER: Modul wsgi existiert nicht! –