Stuck with deploying django with apache + mod_wsgi

apache2, deployment, django, error-log, mod-wsgi

Solution

This problem is covered in both the mod-wsgi documentation http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango and the Django deployment documentation https://docs.djangoproject.com/en/1.4/howto/deployment/wsgi/modwsgi/ which note that the project must be on your Python path. You can use the `WSGIPythonPath` directive or set the `python-path` in your `WSGIDaemonProcess` directive from the Django documentation. Or you can add it to the `sys.path` in your wsgi file as the mod-wsgi docs state.

Problem

I get an 500 internal server error and in the log files it writes: ``` [Thu Jun 14 16:30:22 2012] [error] [client 127.0.0.1] ImportError: Could not import settings 'mysite.settings' (Is it on sys.path?): No module named mysite.settings ``` here is my httpd.conf: ``` ServerName localhost <VirtualHost *:80> ServerAdmin ttt@mysite.com ServerName mysite.com ServerAlias www.mysite.com DocumentRoot /var/www/mysite/ LogLevel warn WSGIDaemonProcess processes=2 maximum-requests=500 threads=1 WSGIScriptAlias / /var/www/mysite/mysite/wsgi.py Alias /media /var/www/mysite/mysite/static/media/ </VirtualHost> ``` wsgi.py: ``` import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings") from django.core.wsgi import get_wsgi_application application = get_wsgi_application() ```

Original source