Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7874693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:51:16+00:00 2026-06-03T02:51:16+00:00

The 1.3 release of Django includes the RemoteUserMiddleware and RemoteUserBackend classes to allow Apache

  • 0

The 1.3 release of Django includes the RemoteUserMiddleware and
RemoteUserBackend classes to allow Apache to do authentication.
See http://docs.djangoproject.com/en/dev/howto/auth-remote-user/

I have an initial_data.json that creates a superuser when syncdb is performed. A dumpdata confirms it.

But I find that it doesn’t seem to login properly with the newly created database. I get an ImproperlyConfigured exception that says:
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 traceback points to RemoteMilddleware.process_request():

def process_request(self, request):
    # AuthenticationMiddleware is required so that request.user exists.
    if not hasattr(request, 'user'):
        raise ImproperlyConfigured(...

The DEBUG output from Apache shows that settings in fact have AuthenticationMiddleware and RemoteUserMiddleware in the requested order:

MIDDLEWARE_CLASSES  
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.RemoteUserMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')

But the request.user attribute is not set, generating the exception.

If I look closer at the source code for django.contrib.auth.backends and middleware,
I find that AuthenticationMiddleware is registering LazyUser for
the request class. But RemoteUserBackend doesn’t seem to have
the authenticate() method called which is where remote_user gets looked up in the Users table.

Is there something I should be doing to get authenticate() to be called in order to create request.user?

I can provide more info as needed. This is using SSL, by the way. Does that have some interaction that I didn’t anticipate?

I should mention that I’m using Apache2.2.14 and mod_wsgi.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T02:51:17+00:00Added an answer on June 3, 2026 at 2:51 am

    I had the same problem and after a little debugging figured out I forgot to create the mysql (I think it’s the same case with sqllite) tables for the auth and other apps. So if you didn’t you’ll need to run python manage.py syncdb or create them some other way

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I had a One-To-Many relationship in Django, like the Django example at http://docs.djangoproject.com/en/dev/topics/db/models/#fields
I am developing an Django application using the Django 1.3.1 release : https://code.djangoproject.com/browser/django/tags/releases/1.3.1 I
After a very standard and minor release, our Apache/Nginx/Django/wsgi setup ceased to function with
I am using the tutorial to deploy Django. [http://devcenter.heroku.com/articles/django] After I do a git
Django 1.4 release notes state: If you're implicitly relying on the path of the
I am using django 1.1 beta release. In my project I want to use
I'm looking at Google App Engine Django on google code but the latest release
I'm working on a Django site, using the Django 1.4 official release. My site
From SDK 1.x.x Release Notes it said that Users can provide Django settings to
The release notes say: Django 1.3 adds framework-level support for Python’s logging module. That's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.