| 1 |
# Flask-DebugToolbar |
| 2 |
|
| 3 |
A [Flask][] extension that injects debugging information into rendered HTML |
| 4 |
pages. Presented as a sidebar with configurable panels of information. |
| 5 |
|
| 6 |
This is a port of the excellent [django-debug-toolbar][ddt]. |
| 7 |
|
| 8 |
[Flask]: https://flask.palletsprojects.com |
| 9 |
[ddt]: https://github.com/jazzband/django-debug-toolbar/ |
| 10 |
|
| 11 |
|
| 12 |
## Pallets Community Ecosystem |
| 13 |
|
| 14 |
> [!IMPORTANT]\ |
| 15 |
> This project is part of the Pallets Community Ecosystem. Pallets is the open |
| 16 |
> source organization that maintains Flask; Pallets-Eco enables community |
| 17 |
> maintenance of related projects. If you are interested in helping maintain |
| 18 |
> this project, please reach out on [the Pallets Discord server][discord]. |
| 19 |
|
| 20 |
[discord]: https://discord.gg/pallets |
| 21 |
|
| 22 |
|
| 23 |
## Example |
| 24 |
|
| 25 |
Setting up the debug toolbar is simple: |
| 26 |
|
| 27 |
```python |
| 28 |
from flask import Flask |
| 29 |
from flask_debugtoolbar import DebugToolbarExtension |
| 30 |
|
| 31 |
app = Flask(__name__) |
| 32 |
app.config["SECRET_KEY"] = "<replace with a secret key>" |
| 33 |
|
| 34 |
toolbar = DebugToolbarExtension(app) |
| 35 |
``` |
| 36 |
|
| 37 |
The toolbar will automatically be injected into Jinja templates when debug |
| 38 |
mode is enabled. |
| 39 |
|
| 40 |
``` |
| 41 |
$ flask -A my_app run --debug |
| 42 |
``` |
| 43 |
|
| 44 |
 |