3๐
Based on:
http://www.webforefront.com/django/setupapachewebserverwsgi.html
the www-data user (user running apache folder) must have read access to the folder containing the django installation. I just did a test where I copied the django installation and my web application to: /var/www/test and changed the permission for that folder:
sudo chgrp -R www-data /var/www/test
sudo chmod -R g+rwx /var/www/test
and the application now loads.
3๐
I got this error just now when I was trying to set up my Django, Nginx and WSGI according to this tutorial: https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
When I typed in the command: uwsgi --http :8000 --module mysite.wsgi
I get the error:
from django.core.wsgi import get_wsgi_application ImportError: No
module named django.core.wsgi
It made no sense to me because when I entered the python shell in my virtualenv and imported the module, it worked perfect.
However, I found this tutorial to be useful in getting rid of the error: https://gist.github.com/evildmp/3094281
uwsgi --http :8000 --module project.wsgi --virtualenv /path/to/virtualenv
Typing in the path to your virtualenv causes WSGI to find the module it was missing.
You can find the path to the virtualenv by typing in $ECHO virtualenv
in your command prompt / terminal.
0๐
I had the same issue.
Reason being that I had installed gunicorn via apt, which was then running in the system-wide Python 2 installation, instead of my venv.
Fixed it by uninstalling the system gunicorn, and then activating my venv, and installing gunicorn to the venv using pip install gunicorn. Then it worked straight away.
- [Django]-How to have nested url namespaces with a dynamic first part in Django
- [Django]-Django sequence:item 4 expected string or unicode int found