Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » Still mystified by mod_wsgi traceback ... [RSS Feed]

#1 Jan. 3, 2011 21:36:38

Stephen W.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Still mystified by mod_wsgi traceback ...


I posted the traceback I'm getting --http://dpaste.com/293813/I'm still completely mystified. The traceback directs me to:
"Edit your MIDDLEWARE_CLASSES setting to insert
'django.contrib.auth.middleware.AuthenticationMiddleware'
before the RemoteUserMiddleware class." But looking further
up in the traceback, it sees that d.c.a.m.AuthenticationMiddleware
*is* there, and it's true -- I already have it in my
MIDDLEWARE_CLASSES setting before the RemoteUserMiddleware class,
so how could mod_wsgi possibly not be finding it?

See below for more details on my configuration ...

Steve

On 12/30/2010 06:17 PM, Stephen Waterbury wrote:I am baffled, and it's probably something simple I'm missing ...
I just need to send a message for help and then I'll see it ...
(maybe ... ;)

My set up:
* apache2 on Ubuntu 10.04
* mod_wsgi 3.3, compiled with python 2.6.5 (the system python)
(but Ubuntu's mod_wsgi package was apparently not the problem)
* django installed in a virtualenv with python 2.6.5 also
* 2 django apps, one running on ':80' virtual host and one on
':8000' virtual host, each with a separate wsgi script (of course)
* apache server config (apache.conf) has WSGIPythonHome directive:
'WSGIPythonHome '
* virtualenv directory has python interpreter in its bin dir and
python packages installed in its lib dir, including all django
libs
* I have verified that AuthenticationMiddleware can be imported
successfully from the command line within the virtualenv using
the virtualenv's python intepreter
* both django apps live within the virtualenv directory,
each in its own "project" directory there
* both apps are configured in apache with WSGIDaemonProcess directive

The error I continue to get is:

"ImproperlyConfigured at /

"The Django remote user auth middleware requires the
authentication middleware to be installed. Edit your
MIDDLEWARE_CLASSES setting to insert
'django.contrib.auth.middleware.AuthenticationMiddleware' before
the RemoteUserMiddleware class."

The relevant sections of the settings.py files for the apps are:
--------------
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.RemoteUserMiddleware',
)

AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.RemoteUserBackend',
)
---------------

Ultimately I'll be using Active Directory (Kerberos) auth, but for
purposes of testing the REMOTE_USER stuff I've configured Basic
Authentication, and it is working (I authenticate successfully
before seeing that error message).

Any suggestions welcome! (I can send the whole error page if it
would help, but I'll need to launder it a little.)

TIA!
Steve--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 5, 2011 03:16:37

Karen T.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

Still mystified by mod_wsgi traceback ...


On Mon, Jan 3, 2011 at 4:36 PM, Stephen Waterbury <
stephen.c.waterb...@nasa.gov> wrote:

> I posted the traceback I'm getting --http://dpaste.com/293813/> I'm still completely mystified. The traceback directs me to:
> "Edit your MIDDLEWARE_CLASSES setting to insert
> 'django.contrib.auth.middleware.AuthenticationMiddleware'
> before the RemoteUserMiddleware class." But looking further
> up in the traceback, it sees that d.c.a.m.AuthenticationMiddleware
> *is* there, and it's true -- I already have it in my
> MIDDLEWARE_CLASSES setting before the RemoteUserMiddleware class,
> so how could mod_wsgi possibly not be finding it?
>

The code issuing this message here is guessing about the cause of the real
problem it has run into, which is that the request object it has been handed
has no user attribute. The most likely reason for no user attribute on the
request at this point is missing AuthenticationMiddleware, but if
AuthenticationMiddleware is in place then there must be something else
causing the problem.

I happened to just stumble across one of these other possible problems: some
other error in the project code. In my case I had a model with a method with
a @Property decorator applied (leftover deliberate error to see what message
that would generate -- should be @property). With that error in place,
adding RemoteUserMiddleware to my config and trying to access the site via
apache/mod_wsgi produced the error message you are seeing. The real error
was obvious when I tried running the dev server, which would not even start
properly with that error in place. Also, removing the RemoteUserMiddleware
from the settings and accessing the site via apache/mod_wsgi showed the true
error. Once I removed the erroneous @Property decorator, the
RemoteUserMiddleware error went away.

I'm not sure why this RemoteUserMiddleware error is having the effect of
hiding other errors, and don't have time to dig into that right now. But one
possible way to figure out what is going on in your case would be to try
removing that middleware and seeing if some other error is reported.

Karen
--http://tracey.org/kmt/--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » Still mystified by mod_wsgi traceback ... [RSS Feed]

Board footer

Moderator control

Enjoy the 19th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support