Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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()
share|improve this question
    
Forget it. I was being a total idiot. I'd set up my vhost file, but I hadn't enabled it in apache. –  hellsgate May 7 '11 at 15:25

1 Answer 1

Make sure to enable your vhost file in apache.

share|improve this answer
    
Cheers Bassett :-) –  hellsgate Dec 8 '11 at 15:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.