-
-
Notifications
You must be signed in to change notification settings - Fork 149
Open
Description
It seems that flask-debugtoolbar is incompatible with flask 2 async endpoints.
Repro:
Run this flask project (app.py) and hit /data to trigger an async call - which works.
Then uncomment the line enabling the DebugToolbarExtension and we get an exception.
import asyncio
from flask import Flask
from flask import render_template
from icecream import ic
from flask_debugtoolbar import DebugToolbarExtension
app = Flask(__name__)
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
app.config['JSON_SORT_KEYS'] = False
app.secret_key = 'super secret key'
# flask debug toolbar - https://flask-debugtoolbar.readthedocs.io/en/latest/index.html#configuration
app.debug = True
app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
app.config['DEBUG_TB_TEMPLATE_EDITOR_ENABLED'] = True
# toolbar = DebugToolbarExtension(app) # <<<< UNCOMMENT THIS AND WATCH IT CRASH
@app.route('/')
def root():
return "hi"
async def async_get_data():
ic('in async function')
await asyncio.sleep(2)
ic('out of async function')
return 'Done!'
@app.route("/data")
async def get_data():
data = await async_get_data()
return datasealemar, xALEx1, akcode47 and caarmen
Metadata
Metadata
Assignees
Labels
No labels