John Gordon
John Gordon

Reputation: 33335

Django error traceback not showing the real error

In a Django view method, I have some code like this:

x = my_dict['foo']

'foo' is not in my_dict, so I'm getting an error traceback screen, as I should.

However, the error screen claims the error is deep in some internal django module, rather than in my code. Here is the traceback information:

Traceback:
File "/usr/lib/python2.3/site-packages/django/core/handlers/base.py" in get_response
  99.                     response = callback(request, *callback_args, **callback_kwargs)

Exception Type: KeyError at /app/login/
Exception Value: 'foo'

Why isn't it showing me the line of code from my view method?

Upvotes: 0

Views: 1337

Answers (2)

Waqas Javed
Waqas Javed

Reputation: 773

It happened to me as django showed me complete error trace only once then after that error trace was not complete.

Try turning DEBUG = True this will show you the complete error log.

Upvotes: 0

Sid
Sid

Reputation: 7631

I believe Django is considering the error to be that the view hasn't returned a valid HTTPResponse and conveying that rather than the reason for the view not conveying the response. I believe this is by design.

To get to the specific error look at your web-server's error log.

Upvotes: 2

Related Questions