pallets-eco

flask-debugtoolbar

flask-debugtoolbar is a Flask extension that injects a sidebar of debug panels into rendered pages under debug mode, showing request, SQL, and template details.

0.16.0
Published at
Sep 28, 2024
978
Stars
39
Download
Synced at
8d ago

The author no longer ships through GitHub Releases, but the repository is still active (last push 23d ago). Get the latest version from: Project homepage

Latest release

0.16.0Sep 28, 2024, 02:56 PM
Downloads slow? Switch the source anytime above

README

Project Overview

Flask-DebugToolbar is a Flask extension that injects debugging information into rendered HTML pages as a sidebar with configurable panels. It is a port of django-debug-toolbar, part of the Pallets Community Ecosystem, and activates automatically when the app runs with flask run --debug.

Item Value
Framework Flask
Language Python
Type Development debug toolbar
License BSD-3-Clause

Inspect request details right inside Flask pages and stop scattering print calls.

Key Features

  • Sidebar injection: automatically injected into Jinja-rendered pages in debug mode
  • Configurable panels: enable information panels as needed
  • SQL inspection: observe queries when paired with flask-sqlalchemy
  • Template info: check template rendering contexts
  • Request details: view current request variables and session data
  • Out of the box: initialize the extension and go, no template changes

Target Audience

  • Flask developers
  • Backend engineers
  • Teams debugging database queries
  • Flask project maintainers
  • Instructors teaching Flask

Quick Start

  1. Install flask-debugtoolbar
pip install flask-debugtoolbar
  1. Initialize the extension
from flask import Flask
from flask_debugtoolbar import DebugToolbarExtension

app = Flask(__name__)
app.config['SECRET_KEY'] = '<replace with a secret key>'

toolbar = DebugToolbarExtension(app)
  1. Run the app in debug mode
flask -A my_app run --debug
  1. Open a page and browse the sidebar panels

Core Advantages

  • No template changes: automatic injection keeps business templates untouched
  • Ecosystem home: a Pallets community project with assured Flask compatibility
  • Simple setup: one initialization line to start

System Requirements

Item Requirement
Framework Flask
Runtime Python
Usage enable in development environments only

Notes

  • SECRET_KEY needed: the extension relies on the app's SECRET_KEY configuration
  • Debug mode only: injected only in debug mode, leaving production untouched
  • Panel lineage: panels are ported from django-debug-toolbar with matching capabilities

Release history

Sort