Skip to content

Commit

Permalink
Enable sentry if SENTRY_DSN is in the env
Browse files Browse the repository at this point in the history
  • Loading branch information
symroe committed Feb 12, 2024
1 parent 162ba39 commit 859c802
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions every_election/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,27 +280,32 @@ def str_bool_to_bool(str_bool):
AWS_S3_FILE_OVERWRITE = True
AWS_DEFAULT_ACL = None


# Disable Basic Auth by default
# We only want to use this on staging deploys
BASICAUTH_DISABLE = True


# elections where polling day is in the range
# (NOW - CURRENT_PAST_DAYS) - (NOW + CURRENT_FUTURE_DAYS)
# are considered "current"
CURRENT_PAST_DAYS = 20
CURRENT_FUTURE_DAYS = 90


# .local.py overrides all the common settings.

with contextlib.suppress(ImportError):
from .local import * # noqa


# importing test settings file if necessary
if IN_TESTING:
from .testing import * # noqa

DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

if sentry_dsn := os.environ.get("SENTRY_DSN"):
import sentry_sdk

sentry_sdk.init(
dsn=sentry_dsn,
# Disable performance monitoring
enable_tracing=False,
)
2 changes: 1 addition & 1 deletion requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
ec2_tag_conditional==0.1.2
gunicorn==20.1.0
jsmin==3.0.1
raven==6.10.0
sentry-sdk

0 comments on commit 859c802

Please sign in to comment.