Skip to content
Snippets Groups Projects
Commit 7c11fd74 authored by Fredrik Jonsson's avatar Fredrik Jonsson
Browse files

Move sentry configuration to production settings.

parent c2ac4df8
No related branches found
No related tags found
No related merge requests found
......@@ -5,10 +5,6 @@ Django settings for opentech project.
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import dj_database_url
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
env = os.environ.copy()
......@@ -552,14 +548,6 @@ MAILCHIMP_API_KEY = env.get('MAILCHIMP_API_KEY')
MAILCHIMP_LIST_ID = env.get('MAILCHIMP_LIST_ID')
# Sentry configuration.
if 'SENTRY_DSN' in env:
sentry_sdk.init(
dsn=env['SENTRY_DSN'],
integrations=[DjangoIntegration()]
)
# Basic auth settings
if env.get('BASIC_AUTH_ENABLED', 'false').lower().strip() == 'true':
MIDDLEWARE.insert(0, 'baipw.middleware.BasicAuthIPWhitelistMiddleware')
......
import os
import django_heroku
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from .base import * # noqa
......@@ -11,8 +14,8 @@ DEBUG = False
# Alternatively, you can set these in a local.py file on the server
env = os.environ.copy()
# Basic configuration
# Mailgun configuration.
if 'MAILGUN_API_KEY' in env:
EMAIL_BACKEND = 'anymail.backends.mailgun.EmailBackend'
ANYMAIL = {
......@@ -21,4 +24,13 @@ if 'MAILGUN_API_KEY' in env:
"WEBHOOK_SECRET": env.get('ANYMAIL_WEBHOOK_SECRET', None)
}
# Sentry configuration.
if 'SENTRY_DSN' in env:
sentry_sdk.init(
dsn=env['SENTRY_DSN'],
environment=env.get('SENTRY_ENVIRONMENT', None),
integrations=[DjangoIntegration()]
)
# Heroku configuration.
django_heroku.settings(locals())
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