meta: add optional setting for flask-debug-toolbar

It provides profiling information and an overview of SQL requests while
in development.
This commit is contained in:
Lephe 2022-05-05 20:32:54 +01:00
parent 5a87d29c7f
commit 8f620c6150
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
3 changed files with 14 additions and 1 deletions

View File

@ -24,3 +24,8 @@ python-pillow
python-pyyaml
python-slugify
```
Optionnel:
```
python-flask-debugtoolbar
```

View File

@ -4,7 +4,7 @@ from flask_migrate import Migrate
from flask_login import LoginManager
from flask_mail import Mail
from flask_wtf.csrf import CSRFProtect
from config import FlaskApplicationSettings
from config import FlaskApplicationSettings, V5Config
app = Flask(__name__)
app.config.from_object(FlaskApplicationSettings)
@ -36,3 +36,9 @@ from app.utils import filters
# Register processors
from app import processors
# Enable flask-debug-toolbar if requested
if V5Config.ENABLE_FLASK_DEBUG_TOOLBAR:
from flask_debugtoolbar import DebugToolbarExtension
app.config['DEBUG_TB_PROFILER_ENABLED'] = True
toolbar = DebugToolbarExtension(app)

View File

@ -78,6 +78,8 @@ class DefaultConfig(object):
# is computed in the page header, so it doesn't account for most of the
# template generation.
SLOW_REQUEST_THRESHOLD = 0.400 # s
# Whether to enable flask-debug-toolbar
ENABLE_FLASK_DEBUG_TOOLBAR = False
class V5Config(LocalConfig, DefaultConfig):