Skip to content
Snippets Groups Projects
Commit a2f81217 authored by Bastien Abadie's avatar Bastien Abadie
Browse files

Merge branch 'sentry-shell' into 'master'

Do not report errors to Sentry in Django shells

Closes #759

See merge request !1389
parents 0495d4cb ea8d6bf6
No related branches found
No related tags found
1 merge request!1389Do not report errors to Sentry in Django shells
......@@ -27,6 +27,9 @@ BASE_DIR = Path(_base_dir) if _base_dir else Path(__file__).resolve().parent.par
# Used for special cases during configuration parsing and settings loading
TEST_ENV = 'test' in sys.argv
# Matches ./manage.py shell[_plus] and arkindex shell[_plus] to disable Sentry reporting
DJANGO_SHELL = sys.argv[1] in ('shell', 'shell_plus')
CONFIG_PATH = Path(os.environ.get('CONFIG_PATH', BASE_DIR / 'config.yml'))
parser = get_settings_parser(BASE_DIR)
conf = parser.parse(CONFIG_PATH, exist_ok=True)
......@@ -613,7 +616,7 @@ try:
except ImportError:
pass
if SENTRY_DSN:
if SENTRY_DSN and not DJANGO_SHELL:
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.logging import ignore_logger
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment