tags:

views:

185

answers:

3

Is there a good way to get the debug information that Django provides when using jQuery to make Ajax calls? Right now when I make a call, I just see a http/200 server error in the python runserver window, but because the call is made through javascript, I don't get a debug page with all the information.

+2  A: 

You can inspect the contents of the response returned to your jQuery ajax call. Using a tool like Firebug can make this pretty easy.

Django will still return the debug page, it's just that it is responding to the ajax call rather than a regular browser request.

It's often a good technique to get your stuff working with regular requests, and then "ajaxify" them only once you are sure the server side code is working.

TM
What's annoying about that is it's all in unparsed HTML format. I guess I could just load it into a div...
victor
Actually Firebug can open the returned HTML as a new tab in Firefox, so you can see it in the proper format.
Daniel Roseman
Ah hah, that'll do it!
victor
A: 

You can use this snippet: http://www.djangosnippets.org/snippets/650/ to get plaintext tracebacks for viewing in firebug, instead of HTML.

Alex Gaynor
A: 

Probably the simplest way is to turn off debug, and rely on email debug messages Django sends. However, this isn't often practical, but it works.

af