pallets-eco / flask-debugtoolbar

A toolbar overlay for debugging Flask applications
https://flask-debugtoolbar.readthedocs.io
BSD 3-Clause "New" or "Revised" License
945 stars 143 forks source link

UserWarning: Could not insert debug toolbar. </body> tag not found in response. #125

Open mrsan22 opened 6 years ago

mrsan22 commented 6 years ago

Hi Team, I am using Flask(0.12.2) with Angular(v6) as front-end framework. I did the setup of the toolbar as described in the documentation. However, the toolbar is not showing up when I load the app. I am getting following warning:

UserWarning: Could not insert debug toolbar. </body> tag not found in response. warnings.warn('Could not insert debug toolbar.' Does the non-appearance of the debug toolbar has to do with the front-end framework I am using (Angular)? Let me know if you need more info here. Thanks!

TzeSing commented 6 years ago

I meet the same problem! Hope the team can deal with it!

ajinkyapuar commented 6 years ago

Facing the same issue

dmitrypol commented 5 years ago

same here. Just a warning in version 0.10.1 but I was wondering if there is a fix?

idchlife commented 5 years ago

I suspect all of you are trying to use debug toolbar with JSON based responses, not HTML based responses, yes?

Debug toolbar works only when rendering html pages from flask.

jeffwidman commented 4 years ago

Note to self: Add DEBUG-level logging of the response, that way it'd be easy to see what's actually getting returned...

extant1 commented 4 years ago

I'm using Htmx library which uses AJAX that returns html in the background which it then uses to updates the DOM. It's not really a problem but would it be possible to add a decorator or config option to list endpoints for debugtoolbar to ignore?

PBorocz commented 8 months ago

HTMX user here as well. FWIW, django_debugtoolbar offers a mechanism to turn OFF debugToolbar on specified routes (for example, HTMX calls that are still returning clean HTML, just not total pages) using the SHOW_TOOLBAR_CALLBACK variable (see https://stackoverflow.com/a/75813120/635040 for an example)

Minimally, would still be nice to be able to mute the "body tag not found" warning!

acbart commented 2 weeks ago

Why was #125 marked as a duplicate of this? https://github.com/pallets-eco/flask-debugtoolbar/issues/159#issuecomment-2088444680

The requests seem to be different. Unless you're looking at this? https://github.com/pallets-eco/flask-debugtoolbar/issues/125#issuecomment-678695735

Either way, the ability to toggle per endpoint is such a critical feature.

macnewbold commented 1 week ago

My impression is that we'd consider them duplicates because they're two requests (albeit for different motivations or use cases) that end up asking for the same thing - a way to turn off the toolbar on specific routes. While they may be different, I'd argue that they have the same solution, so tracking them together makes sense.