mirror of
https://github.com/pallets-eco/flask-debugtoolbar.git
synced 2026-01-07 05:59:37 -06:00
Drop `flask_script` in favor of Flask's native CLI: * https://flask.palletsprojects.com/en/master/cli/ This also requires changing the tests so that `pytest` mocks the env var `FLASK_ENV` so that the test app starts in development mode. Unlike normal test apps, we _do_ want development/debug mode, in addition to testing mode.
31 lines
730 B
Python
31 lines
730 B
Python
from flask import Flask, render_template
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
from flask_debugtoolbar import DebugToolbarExtension
|
|
|
|
|
|
app = Flask('basic_app')
|
|
app.config['SECRET_KEY'] = 'abc123'
|
|
|
|
# TODO: This can be removed once flask_sqlalchemy 3.0 ships
|
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
|
|
|
# make sure these are printable in the config panel
|
|
app.config['BYTES_VALUE'] = b'\x00'
|
|
app.config['UNICODE_VALUE'] = u'\uffff'
|
|
|
|
toolbar = DebugToolbarExtension(app)
|
|
db = SQLAlchemy(app)
|
|
|
|
|
|
class Foo(db.Model):
|
|
__tablename__ = 'foo'
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
|
|
|
|
@app.route('/')
|
|
def index():
|
|
db.create_all()
|
|
Foo.query.filter_by(id=1).all()
|
|
return render_template('basic_app.html')
|