Closed rogerbinns closed 9 years ago
Sorry for this extremely late response.
It's not strictly necessary to store the toolbar in a variable, since it will register itself with Flask's hooks which will prevent it from being garbage collected. Storing it is useful if you want to call toolbar.init_app(app)
, but not required otherwise. However, this is a common pattern for how extensions are initialized so I've just left it there for consistency.
With #20 merged, it will now emit a warning when the </body>
tag is not present, and the toolbar isn't inserted. There is another issue #79 still open for addressing that in a better way, so I'll close this out in favor of that.
Not mentioned in the example shown are two things. One is why you save to a toolbar variable that is never used. (Presumably this is to prevent garbage collection in which case a comment to that effect would be helpful.)
The second is that the template being rendered requires a
<head>
section. The simplest template shown in http://flask.pocoo.org/docs/quickstart/ (search for "Here is an example template") omits html/head/body and as a result the toolbar doesn't show up.