Disable django-debug-toolbar when running tests

This commit is contained in:
Adam Goldsmith 2024-06-05 11:02:21 -04:00
parent 9f24286701
commit 31c9a9b13d

View File

@ -1,4 +1,5 @@
import os
import sys
from pathlib import Path
from django.core import validators
@ -303,8 +304,15 @@ class Dev(NonCIBase):
DEBUG = values.BooleanValue(True)
INTERNAL_IPS = ["127.0.0.1"]
INSTALLED_APPS = NonCIBase.INSTALLED_APPS + ["debug_toolbar", "django_extensions"]
MIDDLEWARE = ["debug_toolbar.middleware.DebugToolbarMiddleware"] + Base.MIDDLEWARE
INSTALLED_APPS = NonCIBase.INSTALLED_APPS + ["django_extensions"]
# bit of a hack to disable debug toolbar when running tests
if DEBUG and "test" not in sys.argv:
INSTALLED_APPS += ["debug_toolbar"]
MIDDLEWARE = NonCIBase.MIDDLEWARE + [
"debug_toolbar.middleware.DebugToolbarMiddleware",
]
EMAIL = values.EmailURLValue("smtp://localhost:1025") # for local `mailpit`
SENDFILE_BACKEND = "django_sendfile.backends.development"