I am trying to execute a small django project with the following Apache configuration:
Apache virtual host configuration:
<VirtualHost *> ServerName servername [...] <Directory "/path/to/project/project"> <Files wsgi.py> Require all granted </Files> </Directory> WSGIDaemonProcess project python-path=/path/to/project:/path/to/Envs/venv/lib/python3.5/site-packages WSGIScriptAlias / /path/to/project/project/wsgi.py </VirtualHost>
I also have the following wsgi.py:
import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings") application = get_wsgi_application()
I have no problems with STATIC and MEDIA files.
I also checked permissions and tried recursively using 755 and then 777 in the virtualenv site-package directory. This did not work.
But when I try to reach the root of my site, I get the following:
from django.core.wsgi import get_wsgi_application ImportError: No module named 'django'
I assumed that this is a problem with the Python path since django is installed in my virtualenv. But I added the appropriate python paths to the WSGIDaemonProcess python-path attribute, so I donโt understand why it is not working.
I also assume that I can add the appropriate directory to my Python path in my wsgi.py using the site module , but I would like to understand why the Apache configurations I tried are not enough. Did I miss something?
source share