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:
parent
5a87d29c7f
commit
8f620c6150
|
@ -24,3 +24,8 @@ python-pillow
|
|||
python-pyyaml
|
||||
python-slugify
|
||||
```
|
||||
|
||||
Optionnel:
|
||||
```
|
||||
python-flask-debugtoolbar
|
||||
```
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue