Django Debug Toolbar is not presented after PUT request DRF
DjDT disappears after making either PUT or PATCH requests in the browsable DRF API. For GET and POST requests everything works fine. After a single PUT request debug toolbar disappears. And after a single GET request, it shows back.
If open dev tools, djdt keeps being presented inside of HTML.
The server is running on the localhost with DEBUG=True.
I followed the official installation tutorial:
"127.0.0.1"are listed inINTERNAL_IPS'debug_toolbar.middleware.DebugToolbarMiddleware'listed as high as possible. Higher only'corsheaders.middleware.CorsMiddleware'and'django.middleware.security.SecurityMiddleware'
Has anyone met with this?
That's interesting. I had the suspicion that maybe the toolbar JS fails since it hooks into XHR/fetch but it doesn't look as if a failure should hide the toolbar.
running djdt.init() in the browser console made the toolbar show up
POST method doesn't work either
Hi folks. Would either of you be able to create a reproducible example for us to investigate?
Hi folks. Would either of you be able to create a reproducible example for us to investigate?
https://www.loom.com/share/b18a95dc61d647329a9232b0eddd07e9?sid=b3560fd2-7dd4-4dc6-a2ed-d1492ccf7ec4 Please refer to this video to see the bug logged. The toolbar disappears when i make a put or post request. Gets back on GET request?
Thank you @HarshGuptaShorthillsAI. I didn't doubt that it was happening. What I'm looking for is a minimal django project that reproduces this so I can look into why exactly this is happening on my local machine. There could be a slight difference in how you have the project setup versus what I would do. That could lead to the difference in results.
The toolbar has an example project if you want to fork that and start from there.
Surprisingly did not have to do anything special to reproduce it, just latest django, drf (+basic api), djdt. Tried both chrome (heavy extension use) and firefox (vanilla).
https://github.com/MaziyarMK/djdt_bug
Lemme know if that does reproduce on your side as well.
DRF 3.15 now includes a fix to address this issue.