I have installed Django and mod_wsgi-express on an ubuntu 15.10. Basically (notice I did not do this as root):
pip install Django
pip instal
The problem was in the include path:
import sys
#Wrong!
#sys.path.append("/home/user/mysite/mysite")
#Correct
sys.path.append("/home/user/mysite")
I had this error too, when I was trying to move a windows project to Debian.
import sys
sys.path.append("your project path")
Please try:
import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(BASE_DIR)
os.environ['DJANGO_SETTINGS_MODULE'] = 'YOURAPP.settings'
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "YOURAPP.settings")
This is working for scripts in main project directory, as well ..
add this to your wsgi.py file
path = '/home/path/to/project'
if path not in sys.path:
sys.path.append(path)
before setting
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
Also, if you are using Visual Studio, check that your app properties for Django match the settings module that you are expecting. By default, it is set to $(MSBuildProjectName).settings, which was a problem for me since my project name and app name were not the same.
You can find this setting by right clicking on your app in the Solution Explorer and clicking on "Properties" and then the Django tab on the left.