Skip to main content

Flask Debug Toolbar MongoDB Panel

Info:

An extension panel for Matt Good’s Flask-DebugToolbar that adds MongoDB debugging information

Author:

Bruno Carlin (http://github.com/bcarlin, http://twitter.com/brunocarlin)

History

This is a port of the MongoDB addon to the Django Debug Toolbar written by Harry Marr (http://github.com/hmarr, http://twitter.com/harrymarr).

There existed another port (https://github.com/cenkalti/flask-debug-toolbar-mongo) that was neither up-to-date nor operational (there are still imports from django).

Here is a clean port that I intend to maintain current with Harry Marr’s original work, and occasionnally augment with new features if needed.

All the thanks go to Harry!

Setup

First, you need to get the package. Install it with pip:

pip install flask-debugtoolbar-mongo

Somewhere after you’ve set app.debug = True and before app.run, you need to specify the flask_debugtoolbar panels that you want to use and include 'flask_debugtoolbar_mongo.panels.MongoDebugPanel' in that list.

For example, here’s a small flask app with the panel installed and with line profiling enabled for the hello_world:

from flask import Flask
app = Flask(__name__)

import flask_debugtoolbar

@app.route('/')
def hello_world():
    return 'Hello World')

if __name__ == '__main__':
    app.debug = True

    # Specify the debug panels you want
    app.config['DEBUG_TB_PANELS'] = [
        'flask_debugtoolbar.panels.versions.VersionDebugPanel',
        'flask_debugtoolbar.panels.timer.TimerDebugPanel',
        'flask_debugtoolbar.panels.headers.HeaderDebugPanel',
        'flask_debugtoolbar.panels.request_vars.RequestVarsDebugPanel',
        'flask_debugtoolbar.panels.template.TemplateDebugPanel',
        'flask_debugtoolbar.panels.sqlalchemy.SQLAlchemyDebugPanel',
        'flask_debugtoolbar.panels.logger.LoggingPanel',
        'flask_debugtoolbar.panels.profiler.ProfilerDebugPanel',
        # Add the MongoDB panel
        'flask_debugtoolbar_mongo.panel.MongoDebugPanel',
    ]
    toolbar = flask_debugtoolbar.DebugToolbarExtension(app)

    app.run()

Flask-debugtoolbar-mongo accepts the following configration options:

app.config['DEBUG_TB_MONGO'] = {
  'SHOW_STACKTRACES' = True
  'HIDE_FLASK_FROM_STACKTRACES' = True
}
SHOW_STACKTRACES

Obtaining stack traces can slow down queries significantly. You can turn them off by setting this option to False.

HIDE_FLASK_FROM_STACKTRACES

Hides Flask calls from the stacktrace.

Release files for Flask-DebugToolbar-Mongo 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-DebugToolbar-Mongo 0.1
File Size Uploaded
Flask-DebugToolbar-Mongo-0.1.tar.gz 8.7 kB Details

Release files / Flask-DebugToolbar-Mongo-0.1.tar.gz

Download URL Flask-DebugToolbar-Mongo-0.1.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a680d5042444fb10a2f511ea5613f00932f51f0c899c5cfe91a3b473658cb1a4
BLAKE2b-256 checksum
How to use checksums
5dea77abd58676ad76ee41ff881597f6e8e88796944940ec06eb22d0c9033a4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page