Please help, I could find error. I'm using django 1.11 and apache (on centos)
There is my wsgi.py
import os
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
activate_this = os.path.expanduser("/var/project/project_python35_venv/bin/activate_this.py")
execfile(activate_this, dict(__file__=activate_this))
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
my django.conf (of httpd)
WSGILazyInitialization On
WSGIRestrictEmbedded On
WSGIPassAuthorization On
WSGIDaemonProcess project user=apache group=apache processes=10 threads=10 maximum-requests=10000 python-path=/var/project/project_python35_venv/lib/python3.5/site-packages python-home=/var/project/project_python35_venv/lib/python3.5
#WSGIProcessGroup project
#WSGIApplicationGroup %{GLOBAL}
#WSGIPythonHome /var/project/project_python35_venv/lib/python3.5
<VirtualHost *:80>
<Directory /var/project/project_python35_venv>
Require all granted
</Directory>
CustomLog /var/log/httpd/project-access.log common
ErrorLog /var/log/httpd/project-error.log
DocumentRoot /var/project/project/project/
WSGIScriptAlias / /var/project/project/project/wsgi.py
Alias /static /var/project/project/project/static/
<Directory /var/project/project/project/static>
Require all granted
</Directory>
<Directory /var/project/project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
I'm trying all cases, but still got this error on my log of httpd :
ImportError: No module named site
Thank you all for the help
Try this
wsgi
import os
import sys
PROJECT_DIR = '/var/project'
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project.settings")
def execfile(filename):
globals = dict( __file__ = filename )
exec( open(filename).read(), globals )
activate_this = os.path.join( PROJECT_DIR, 'project_python35_venv/bin', 'activate_this.py' )
execfile( activate_this )
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
and apache.conf
WSGILazyInitialization On
WSGIRestrictEmbedded On
WSGIPassAuthorization On
WSGIDaemonProcess project python-path=/var/project/project/:/var/project_python35_venv/lib/python3.5/site-packages/
WSGIProcessGroup project
<VirtualHost *:80>
<Directory /var/project/project_python35_venv>
Require all granted
</Directory>
CustomLog /var/log/httpd/project-access.log common
ErrorLog /var/log/httpd/project-error.log
DocumentRoot /var/project/project/
WSGIScriptAlias / /var/project/project/wsgi.py
Alias /var/project/project/static /var/project/project/static/
<Directory /var/project/project/static>
Require all granted
</Directory>
<Directory /var/project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>