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

  • SEARCH
  • Home
  • 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 7443193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:17:37+00:00 2026-05-29T11:17:37+00:00

I’m getting a pretty nasty KeyError after logging into the Django admin. It is

  • 0

I’m getting a pretty nasty KeyError after logging into the Django admin. It is unable to find the key “user”. If it helps, I have a model named “User”.

How do I fix this? Could something be wrong with my configuration? I am using the default admin configuration mentioned in the Django tutorials.

[07/Feb/2012 19:04:52] "GET /web/admin/ HTTP/1.1" 500 1865

http://localhost:8000/web/admin/
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py", line 214, in wrapper
    return self.admin_view(view, cacheable)(*args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/utils/decorators.py", line 93, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/cache.py", line 79, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py", line 197, in inner
    return view(request, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/cache.py", line 79, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/sites.py", line 382, in index
    context_instance=context_instance
  File "/usr/local/lib/python2.6/dist-packages/django/shortcuts/__init__.py", line 20, in render_to_response
    return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
  File "/usr/local/lib/python2.6/dist-packages/django/template/loader.py", line 188, in render_to_string
    return t.render(context_instance)
  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 123, in render
    return self._render(context)
  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 117, in _render
    return self.nodelist.render(context)
  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 744, in render
    bits.append(self.render_node(node, context))
  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 757, in render_node
    return node.render(context)
  File "/usr/local/lib/python2.6/dist-packages/django/template/loader_tags.py", line 127, in render
    return compiled_parent._render(context)
  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 117, in _render
    return self.nodelist.render(context)
  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 744, in render
    bits.append(self.render_node(node, context))
  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 757, in render_node
    return node.render(context)
  File "/usr/local/lib/python2.6/dist-packages/django/template/loader_tags.py", line 127, in render
    return compiled_parent._render(context)
  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 117, in _render
    return self.nodelist.render(context)
  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 744, in render
    bits.append(self.render_node(node, context))
  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 757, in render_node
    return node.render(context)
  File "/usr/local/lib/python2.6/dist-packages/django/template/loader_tags.py", line 64, in render
    result = block.nodelist.render(context)
  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 744, in render
    bits.append(self.render_node(node, context))
  File "/usr/local/lib/python2.6/dist-packages/django/template/base.py", line 757, in render_node
    return node.render(context)
  File "/usr/local/lib/python2.6/dist-packages/django/contrib/admin/templatetags/log.py", line 19, in render
    user_id = context[self.user].id
  File "/usr/local/lib/python2.6/dist-packages/django/template/context.py", line 55, in __getitem__
    raise KeyError(key)
KeyError: u'user'

[07/Feb/2012 19:06:28] "GET /web/admin/ HTTP/1.1" 500 1865

Here is part of my settings.py:

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
#     'django.template.loaders.eggs.Loader',
)

TEMPLATE_CONTEXT_PROCESSORS = (
     'django.core.context_processors.request',
     'django.contrib.messages.context_processors.messages',
)

MIDDLEWARE_CLASSES = (
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'web.exception.Middleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
#    'django.middleware.csrf.CsrfViewMiddleware',
)

TEMPLATE_DIRS = (
    BASE('web/templates')
)

INSTALLED_APPS = (
    'django.contrib.auth',
   'django.contrib.contenttypes',
    'django.contrib.sites',
    'django.contrib.sessions',
    'django.contrib.messages',
    ...
    'django_nose',
    # Uncomment the next line to enable the admin:
    'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',
)
  • 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-05-29T11:17:38+00:00Added an answer on May 29, 2026 at 11:17 am

    Try adding this to your TEMPLATE_CONTEXT_PROCESSORS :

    django.contrib.auth.context_processors.auth

    It makes the user object available to templates through the RequestContext: https://docs.djangoproject.com/en/dev/ref/templates/api/#django-contrib-auth-context-processors-auth

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

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.