I've been trying to teach myself to create and deploy Django apps. I've created a test project and I can browse it using the Django test server. Now I want to deploy it using apache and mod_wsgi.
I followed the installation instructions at the Quick Installation Guide and got mod_wsgi installed. I then went through the example in the Quick Configuration Guide and was able to successfully connect to the example output in my browser.
I've now moved on to the Integration With Django (http://code.google.com/p/modwsgi/wiki/IntegrationWithDjango) section and I can't make any progress with it. Any time I try to browse to the URL I've set up for my project I am instead presented with the output from the example I created with the configuration guide. I've looked at the apache error log and there are no messages in it (I got a few when I was debugging the first example so I know I'm looking at the correct log). I even set 'LogLevel info' to try and get more detail in the logs, but there was none.
Does anyone have any suggestions?
Here is my apach2.conf:
LockFile ${APACHE_LOCK_DIR}/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_event_module>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess
<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy all
</Files>
DefaultType text/plain
HostnameLookups Off [3]:
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
Include mods-enabled/*.load
Include mods-enabled/*.conf
Include httpd.conf
Include ports.conf
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
Include conf.d/
Include sites-enabled/
Here is my httpd.conf:
ServerName HomeServer
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so
Here is the VitualHost:
<VirtualHost *:80>
ServerName ppbase.homeserver
ServerAdmin admin@example.com
DocumentRoot /var/projects/ppbase/ppbase
<Directory /var/projects/ppbase/ppbase>
Order allow,deny
Allow from all
</Directory>
LogLevel info
WSGIScriptAlias / /var/projects/ppbase/django.wsgi
<Directory /var/projects/ppbase>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
And here is the django.wsgi:
import os
import sys
projectpath = '/var/projects/ppbase'
projectapppath = '/var/projects/ppbase/ppbase'
if projectpath not in sys.path:
sys.path.append(projectpath)
if projectapppath not in sys.path:
sys.path.append(projectapppath)
os.environ['DJANGO_SETTINGS_MODULE'] = 'ppbase.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()