Use mod_wsgi on ubuntu
I cannot for the life of me get apache2 and mod_wsgi to work on my django project.
I have a virtualhost with directives setup like this with python-home pointing to my venv:
WSGIDaemonProcess dianarice_art processes=2 threads=12 python-home=/usr/local/virtualenvs/dianarice_venv python-path=/var/www/webapps/ dianarice:/var/www/webapps/dianarice/dianarice:/usr/local/virtualenvs/dianarice_venv/lib/python3.6/site-packages
WSGIScriptAlias / /var/www/webapps/dianarice/dianarice/wsgi.py
I'm getting this error:
ModuleNotFoundError: No module named 'django'
I have it installed in the venv
This is how I installed mod_wsgi
sudo apt-get install libapache2-mod-wsgi-py3
Any help would be appreciated. I am trying to move my webfaction sites to linode ubuntu.
2 Replies
If you installed django through pip then it may be that the directory django is installed in isn't included in the virtualenv configuration. As an alternative, try installing django with:
python -m pip install django
Aside from that, there's a StackOverflow thread here with suggestions on how to fix common configuration problems with mod_wsgi: