1👍
You cannot use different python executeables under the same apache due to the fact that WSGIPythonHome
is set for all virtual hosts globally (see docs). If WSGIPythonHome
is not set – mod_wsgi will use system python.
It seems like you have not set up wsgi.py
correctly. Your goal in wsgi.py
is to manipulate sys.path correctly so that all that your project needs is available. Here’s what helped me when I had same problems: apache server not using proper virtualenv with WSGI setting.
Hope that helps.
1👍
Your configuration is missing:
WSGIProcessGroup mywebsite.com
Without that, your WSGI application isn’t even going to be delegated to the daemon process group. You can check with:
Once you have daemon mode being used properly, so long as you are using mod_wsgi 3.4, you can set Python home for that specific daemon process group using:
WSGIDaemonProcess mywebsite.com python-home=/var/www/empirik/data/www/mywebsite.com/env
That way you can simply point at the root of the Python virtual environment and it will be picked up.
You still need though to specify the python-path option as well to the parent directory of your Django project so it and the settings module can be found, which is the problem you are having. Thus likely you want:
WSGIDaemonProcess mywebsite.com \
python-home=/var/www/empirik/data/www/mywebsite.com/env \
python-path=/var/www/empirik/data/www/mywebsite.com
Now if running only that site in the daemon process group, set:
WSGIApplicationGroup %{GLOBAL}
to avoid issues with C extension modules that don’t work in sub interpreters.
To be safer, instead of:
<Directory /var/www/empirik/data/www/mywebsite.com/myproject>
Order deny,allow
Allow from All
</Directory>
you should use:
<Directory /var/www/empirik/data/www/mywebsite.com/myproject>
<Files wsgi.py>
Order deny,allow
Allow from All
</Files>
</Directory>
That way if screw up Apache configuration, less risk of someone downloading your code and settings file.
And where you have:
<Directory /var/www/empirik/data/www/mywebsite.com/myproject/static>
Order deny,allow
Allow from all
</Directory>
you would appear to be missing the corresponding:
Alias /media /var/www/empirik/data/www/mywebsite.com/myproject/static
If you don’t have an Alias for static media directory, Apache will not serve up files there.
Finally, since you want to force daemon mode and want to avoid embedded mode, set:
WSGIRestrictedEmbedded On
That way if you screw up configuration and things run in embedded mode by mistake as you currently are, you will get an error.
- [Answered ]-URL tag for angular
- [Answered ]-Apache shows 404 error using mod_wsgi for my django application
- [Answered ]-How to chain a queryset together in Django correctly
- [Answered ]-HTSQL – Get Count/number of records to be returned by a query
- [Answered ]-Check the solr query generated by haystack