Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django Debug Toolbar is not presented after PUT request DRF #1743

Open
OleksandrPozden opened this issue Feb 26, 2023 · 8 comments
Open

Django Debug Toolbar is not presented after PUT request DRF #1743

OleksandrPozden opened this issue Feb 26, 2023 · 8 comments

Comments

@OleksandrPozden
Copy link

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 in INTERNAL_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?

@matthiask
Copy link
Member

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.

@maziar-dandc
Copy link

running djdt.init() in the browser console made the toolbar show up

@ArtemIsmagilov
Copy link

POST method doesn't work either

@tim-schilling
Copy link
Contributor

tim-schilling commented Jan 28, 2024

Hi folks. Would either of you be able to create a reproducible example for us to investigate?

@HarshGuptaShorthillsAI
Copy link

HarshGuptaShorthillsAI commented Feb 19, 2024

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?

@tim-schilling
Copy link
Contributor

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.

@maziar-dandc
Copy link

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.

@realsuayip
Copy link

DRF 3.15 now includes a fix to address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants