使用Ajax调用时获取Django调试信息? [英] Getting Django debug information when using Ajax call?
问题描述
在使用jQuery进行Ajax调用时,是否有一个很好的方法来获取Django提供的调试信息?现在当我打电话时,我在python runserver窗口中看到一个http / 200服务器错误,但由于通过javascript进行调用,所以我没有得到一个包含所有信息的调试页面。
您可以检查返回到jQuery ajax调用的响应的内容。使用像Firebug这样的工具可以使这很容易。
Django仍然会返回调试页面,它只是响应ajax调用而不是常规的浏览器请求
通常情况下,让您的东西能够按照常规请求工作,然后只要一旦确定服务器端代码正常工作,就可以ajaxify p>
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.
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.
这篇关于使用Ajax调用时获取Django调试信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!