diff --git a/repapp/repapp/settings.py b/repapp/repapp/settings.py index 5090e2d..9fc1a4e 100644 --- a/repapp/repapp/settings.py +++ b/repapp/repapp/settings.py @@ -15,6 +15,9 @@ import logging from pathlib import Path from django.utils.translation import gettext_lazy as _ +# Set debug mode according to env variable +DEBUG = os.getenv("DJANGO_DEBUG", "false").lower() in ("true", "1", "t") + # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -51,13 +54,15 @@ INSTALLED_APPS = [ "crispy_bootstrap5", # for creating thumbnails, used by email_interface demo views 'easy_thumbnails', - # Django debug toolbar - 'debug_toolbar', ] +if DEBUG: + INSTALLED_APPS += [ + # Django debug toolbar + 'debug_toolbar', + ] + MIDDLEWARE = [ - # Django debug toolbar - 'debug_toolbar.middleware.DebugToolbarMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', # enable translation @@ -69,6 +74,12 @@ MIDDLEWARE = [ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] +if DEBUG: + MIDDLEWARE = [ + # Django debug toolbar + 'debug_toolbar.middleware.DebugToolbarMiddleware', + ] + MIDDLEWARE + ROOT_URLCONF = 'repapp.urls' TEMPLATES = [ @@ -146,9 +157,6 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' # Repapp configuration ###################### -# Set debug mode according to env variable -DEBUG = os.getenv("DJANGO_DEBUG", "false").lower() in ("true", "1", "t") - # basic Python logging configuration LOG_LEVEL = "INFO" if DEBUG: diff --git a/requirements_dev.txt b/requirements_dev.txt index 2270164..be7ecc2 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -8,3 +8,4 @@ pylint-django==2.5.3 pylint-plugin-utils==0.7 selenium==4.9.0 django-debug-toolbar==4.2.0 +coverage==7.3.0