smwilsonau
smwilsonau

Reputation: 199

Getting django to work with apache/mod_wsgi... any ideas?

I have read several tutorials, but I just can't this to work. My apache config file looks like this (with the important few lines at the bottom):

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log
    LogLevel warn

WSGIScriptAlias /wsgi/ /neuroling/projects/lnldb/lnldbproject/lnldb.wsgi
<Directory /neuroling/projects/lnldb/lnldbproject/>
  Order allow,deny
  Allow from all
</Directory>

My lnldb.wsgi file looks like this:

import os
import sys

path = '/neuroling/projects/lnldb'
if path not in sys.path:
    sys.path.append(path)

path = '/neuroling/projects/lnldb/lnldbproject'
if path not in sys.path:
    sys.path.append(path)

os.environ['DJANGO_SETTINGS_MODULE'] = 'lnldbproject.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Now if I go to [MY_IP_ADDRESS]/wsgi with my broswer, I see this:

Using the URLconf defined in lnldbproject.urls, Django tried these URL patterns, in this order: ^admin/ The current URL, , didn't match any of these.

Fair enough, I haven't really given it a URL. But at least lnldb.wsgi is getting called.

But I want to see the admin, so I go to [MY_IP_ADDRESS]/wsgi/admin, and I just get:

Not Found The requested URL /wsgi/admin was not found on this server.

Could someone please point out what I'm doing wrong, I'm sure it's something rather simple...

Thanks a lot.

Upvotes: 1

Views: 1712

Answers (1)

Graham Dumpleton
Graham Dumpleton

Reputation: 58523

Change:

WSGIScriptAlias /wsgi/ /neuroling/projects/lnldb/lnldbproject/lnldb.wsgi

to:

WSGIScriptAlias /wsgi /neuroling/projects/lnldb/lnldbproject/lnldb.wsgi

You should not have a trailing slash on mount point when mounted at sub URL for a start.

Upvotes: 2

Related Questions