hi.. your request is GET, and you try get the query data with POST .
this the errror cause
16. username = request.POST['username']
Exception Value: "Key 'username' not found in <QueryDict: {}>"
check your login form to use POST..
HTH,
Mulianto
On Sat, Aug 20, 2011 at 9:59 PM, Phil <[email protected]> wrote:
> Hi,
>
> I am new to Django and am trying to use the built in auth features for the
> first time. I have been following the steps on the djangobook website
> here...
>
> http://www.djangobook.com/en/1.0/chapter12/
>
> However I am getting the following error on my login page. Anyone know
> where I am going wrong?...
>
>
> Environment:
>
>
> Request Method: GET
> Request URL: http://127.0.0.1:8080/login/
>
> Django Version: 1.3
> Python Version: 2.7.1
> Installed Applications:
> ['django.contrib.auth',
> 'django.contrib.contenttypes',
> 'django.contrib.sessions',
> 'django.contrib.sites',
> 'django.contrib.messages',
> 'django.contrib.staticfiles',
> 'django.contrib.admin',
> 'django.contrib.admindocs',
> 'healthapp',
> 'healthapp.myhealth']
> Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware')
>
>
> Traceback:
> File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
> in get_response
> 111. response = callback(request, *callback_args, **callback_kwargs)
> File "/home/phil/mydev/projects/healthapp/../healthapp/views.py" in login
> 16. username = request.POST['username']
> File
> "/usr/local/lib/python2.7/dist-packages/django/utils/datastructures.py" in
> __getitem__
> 256. raise MultiValueDictKeyError("Key %r not found in %r" % (key, self))
>
> Exception Type: MultiValueDictKeyError at /login/
> Exception Value: "Key 'username' not found in <QueryDict: {}>"
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/9zw1FCvQ33kJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.