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
Flask debug toolbar doesnt show queries(shows unavailable) #7
Comments
I'm sorry, this should be on the documentation. In order to see the queries on the Flask debug toolbar, you must activate first the query recording using the argument db = SQLAlchemy(SQLALCHEMY_URI, app=app, record_queries=True) (In """
pip install flask, sqlalchemy_wrapper, flask_debugtoolbar
"""
from flask import Flask
from sqlalchemy_wrapper import SQLAlchemy
app = Flask(__name__)
app.config['DEBUG'] = True
app.config['SECRET_KEY'] = 'loremipsumsitamet'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
app.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
db = SQLAlchemy(
app.config['SQLALCHEMY_DATABASE_URI'],
record_queries=app.config['DEBUG'],
app=app
)
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.Unicode)
@app.route("/")
def hello():
db.query(User).all()
return "<html><body>Hello World!</body></html>"
db.create_all()
db.add(User(name=u'Test'))
db.commit()
if __name__ == "__main__":
if app.config['DEBUG']:
import flask_debugtoolbar
flask_debugtoolbar.DebugToolbarExtension(app)
app.run() |
BTW, although SQLAlchemy-Wrapper is kind-of framework-independent this integration only works with Flask and Flask-DebugToolbar :( |
As i am trying to make the "transition" from Flask-SQLAlchemy to your fork i found this problem where the debug toolbar doesnt show information about the queries, it just tells me that i have to install Flask-SQLAlachemy.
I saw a commit about supporting the toolbar in your fork but im not expert to debug what is wrong cause maybe im missing something.
The text was updated successfully, but these errors were encountered: