diff --git a/README.md b/README.md index 2f08f3aa..ffe680db 100644 --- a/README.md +++ b/README.md @@ -186,6 +186,18 @@ Pour lancer les tests : python manage.py test ``` +### Astuces + +- En développement on utilise la django debug toolbar parce que c'est utile pour + débuguer les templates ou les requêtes SQL mais des fois c'est pénible parce + ça fait ramer GestioCOF (surtout dans wagtail). + Vous pouvez la désactiver temporairement en définissant la variable + d'environnement `DJANGO_NO_DDT` dans votre shell : par exemple dans + bash/zsh/…: + ``` + $ export DJANGO_NO_DDT=1 + ``` + ## Documentation utilisateur diff --git a/cof/settings/dev.py b/cof/settings/dev.py index fc2f13f9..afc944e0 100644 --- a/cof/settings/dev.py +++ b/cof/settings/dev.py @@ -3,6 +3,8 @@ Django development settings for the cof project. The settings that are not listed here are imported from .common """ +import os + from .common import * # NOQA from .common import INSTALLED_APPS, MIDDLEWARE, TESTING @@ -37,7 +39,8 @@ def show_toolbar(request): machine physique n'est pas forcément connue, et peut difficilement être mise dans les INTERNAL_IPS. """ - return DEBUG and not request.path.startswith("/admin/") + env_no_ddt = bool(os.environ.get("DJANGO_NO_DDT", None)) + return DEBUG and not env_no_ddt and not request.path.startswith("/admin/") if not TESTING: