How are you meant to debug errors in Flask? Print to the console? Flash messages to the page? Or is there a more powerful option available to figure out what\'s happening
One can also use the Flask Debug Toolbar extension to get more detailed information embedded in rendered pages.
from flask import Flask
from flask_debugtoolbar import DebugToolbarExtension
import logging
app = Flask(__name__)
app.debug = True
app.secret_key = 'development key'
toolbar = DebugToolbarExtension(app)
@app.route('/')
def index():
logging.warning("See this message in Flask Debug Toolbar!")
return ""
Start the application as follows:
FLASK_APP=main.py FLASK_DEBUG=1 flask run