Flask-Debug
Flask-Debug is a simple WIP Flask-extension, intended solely for development. Example usage:
from flask import Flask from flask_debug import Debug app = Flask(__name__) Debug(app) app.run(debug=True)
Now opening http://localhost:5000/_debug will show some information about the application, such as a list of registered views, url maps or configuration values.
Security
Of course, this should never be enabled on a production server. If the application is not running in debug mode, the extension will refuse any interaction with the outside world.
Writing your own plugins
It’s fairly easy to ship a plugin for Flask-Debug with your own package or Flask-extension. This allows you to ship debugging tools right along with the extension.
First, create a package named flask_debug_yourname, the prefix flask_debug_ is important. Your __init__.py should look somewhat like this:
# file: flask_debug_myext/__init__.py
template_folder = 'templates'
def initialize_debug_ext(dbg):
@dbg.route('/_myext/status')
def debug_list_extensions():
status = 'all good'
return render_template('myext/status.html', status=status)
initialize_debug_ext() will be called with a flask.Blueprint-Object as the first parameter, onto which you can register your own routes. The route() function will automatically a menu entry (to suppress this behavior, add an argument of menu_name=None).
There are a few conventions:
Views in plugins should start with debug_.
URLs in routes should start with underscore + your extension name.
Inside your templates-folder, you should also create subfolder named myext for all of your templates, as the template namespace is global.
Using Bootstrap, Flask-Debug ships a few base templates which you can use:
{# file: flask_debug_myext/templates/myext/status.html #}
{% extends "flask_debug/base.html" %}
{% block content %}
{{super()}}
<h1>Status for myext</h1>
<p>Current status: {{status}}</p>
{% endblock %}
To finally load the plugin, just do:
import flask_debug_myext
in your extension. Before registering the debugging-blueprint onto the app, Flask-Debug will query sys.modules for all modules that look like Flask-Debug plugins and collect them.
You can check out the flask_debug_plugins-plugin (which lists all installed plugins) for an example.
Metadata
Release files for Flask-Debug 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Flask-Debug-0.3.tar.gz | 5.1 kB | Without provenance | Details for Flask-Debug-0.3.tar.gz |
Release files / Flask-Debug-0.3.tar.gz
| Download URL | Flask-Debug-0.3.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afe99490c5594019cfee944c1aba1e0b42e85d7984ecbac8fb7c7ed1b881f8b8
|
|
BLAKE2b-256 checksum How to use checksums |
48d33dbdd8df0b825a8fc5cec5f10b0fd6d37579ed09ad2f0c7436f676e51191
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for Flask-Debug 0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.