I tried to install django to work with apache and mod_wsgi but get this error:
ImportError: No module named django.core.handlers.wsgi,
I\'v rea
This line is certainly wrong:
sys.path.append('/usr/lib/python2.4/site-packages/django')
Install Django with/for the version of Python that mod_wsgi was built against.
Hello!
If you use deb-distributive of Linux (Debian, Ubuntu, etc), edit the file
/etc/apache2/modules/wsgi.load
This file contained path to correct wsgi-library (for active version Python interpreter). If you use Python2.6, change string
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so-2.7
to
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so-2.6
Also, you can change soft link to mod_wsgi module:
cd /usr/lib/apache2/modules
ln -s mod_wsgi.so-2.6 mod_wsgi.so
Not forget change link to file in /etc/apache2/modules/wsgi.load and restart apache server
service apache2 restart
P.S. Sorry for my bad English
Wrong:
WSGIDaemonProcess www.example.com python-path=~/virtualenvs/virt1/lib/python2.7
Right:
WSGIDaemonProcess www.example.com python-path=/home/user/virtualenvs/virt1/lib/python2.7
I spent way too much time trying to figure out why my virtualenv wasn't loading django properly.
I solved the problem by adding location of site-packages, where I have kept django subdirectory (/Library/python/2.7/site-packages) to WSGIDaemonProcess:
WSGIDaemonProcess www.example.com processes=2 threads=15 display-name=%{GROUP}
python-path=/Library/python/2.7/site-packages
If you are using embedded server mode use in httpd.conf
:
WSGIPythonPath /Library/python/2.7/site-packages