mirror of
https://github.com/pallets-eco/flask-debugtoolbar.git
synced 2026-01-08 06:30:03 -06:00
use standard project layout and tool config across all pallets and pallets-eco projects * add issue templates * add dependabot grouped updates for actions and pypi * add lock inactive closed issues workflow * add publish workflow with slsa and trusted publishing * simplify tests workflow matrix * simplify docs config.py * show license in docs * use pip-compile to pin development dependencies * rename test to tests * add .editorconfig * simplify .gitignore * add pre-commit hooks (will run formatters in a subsequent PR) * pin os and python in .readthedocs.yaml * update license with original commit date and pallets-eco * use pyproject.toml and flit_core instead of setuptools * only declare flask dependency * add config for mypy and pyright (will add typing in a subsequent PR) * readme is markdown * add pallets-eco message to readme * remove install and docs links from readme * add style, typing, docs tox envs * use faster wheel building tox config * add tox command to update dev dependencies
36 lines
935 B
Python
36 lines
935 B
Python
from flask import Flask, render_template
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
from flask_debugtoolbar import DebugToolbarExtension
|
|
|
|
app = Flask('basic_app')
|
|
app.config['DEBUG'] = True
|
|
app.config['SECRET_KEY'] = 'abc123'
|
|
app.config['SQLALCHEMY_RECORD_QUERIES'] = True
|
|
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
|
|
# This is no longer needed for Flask-SQLAlchemy 3.0+,
|
|
# if you're using 2.X you'll want to define this:
|
|
# 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():
|
|
Foo.query.filter_by(id=1).all()
|
|
return render_template('basic_app.html')
|
|
|
|
|
|
with app.app_context():
|
|
db.create_all()
|