-
-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No Context shown in SQLAlchemy tab #96
Comments
I am using blueprints too and I had the same issue, the context is "unknown". I am able to get non-empty Context if my WSGI app is wrapped by ReverseProxied middleware (http://flask.pocoo.org/snippets/35/) -- but the Context is then always pointing to the middleware and not the actual code. Flask (0.11.1) See below an app for reproducing the issue. There are several "tunables" which all are True except "classic" in my production system: reverse_proxied, classic, profiled, blueprinted. Only reverse_proxied seems to have impact on the Context in the debug toolbar. If I would put all modules into one (mock.py), the Context column would display the correct function and line. So the culprit is perhaps hidden in the module imports -- but I am not able to find it. mock.py:
mock_model.py:
mock_app.py:
mock_view.py:
|
Here's how Flask-SQLAlchemy generates the context(_calling_context):
To fix this, simply explicitly pass the name of your app to |
Wow, thank you! My Flask application resides in a module app.py in a package called the same as my application. The SQLAlchemy queries are located in several modules (using the "gateway" pattern - DB calls/persistence layer are decoupled both from the presentation/view and the business logic) located in sub-packages (=blueprints ="micro-services") of the main application package. Changing the name of the Flask app from Could you please update the documentation (especially https://flask-debugtoolbar.readthedocs.io/en/latest/#usage ) with the hard-coded value + could you please add a warning that such approach may be necessary and why? (or even better: could you change the discovery code to be compatible with the default |
The context column only shown
<unknown>
on all of my pages.I'm using Blueprints, can this cause issues ?
Versions used (not only but related to debugtoolbar):
Config extract:
Edit: making queries from the "main" app file shows context, anything outside seems
<unknown>
The text was updated successfully, but these errors were encountered: