Django Rest Framework Debug Mail and Submit Requests

I use the DRF extension for the se json list for the model, and there I can debug the GET request with the debug-toolbar , but how can I debug the POST and PUT requests?

I have this for settings in debug mode:

 INSTALLED_APPS += ('debug_toolbar',) MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) DEBUG_TOOLBAR_PATCH_SETTINGS = False INTERNAL_IPS = ( '127.0.0.1' ) 

Now when I try to use Intercept redirects in the debug toolbar, it does not show me the toolbar when I do POST .

+5
source share
2 answers

I found django-silk for debugging DRF.

https://github.com/django-silk/silk/

+7
source

You cannot intercept redirects in a viewable APF since it is ajax and is called via javascript. Also the toolbar is not displayed due to ajax call. As a workaround, you can use temporary comment lines in debug_toolbar.middleware.DebugToolbarMiddleware#process_request , which disables the toolbar when ajax is called:

  ... # Don't render the toolbar during AJAX requests. # if request.is_ajax(): # return ... 

Redirects will still not work, but the toolbar will be visible.

0
source

All Articles