Load dotenv on all environments

This commit is contained in:
Sonny Bakker 2021-04-25 12:53:43 +02:00
parent f326a4c923
commit b106ebf827
3 changed files with 10 additions and 7 deletions

View file

@ -2,10 +2,15 @@ import os
from pathlib import Path
from dotenv import load_dotenv
load_dotenv()
try:
from sentry_sdk.integrations.celery import CeleryIntegration
from sentry_sdk.integrations.django import DjangoIntegration
from .sentry import sentry_filter
except ImportError:
CeleryIntegration = None
DjangoIntegration = None
@ -258,6 +263,7 @@ SENTRY_CONFIG = {
"dsn": os.environ.get("SENTRY_DSN"),
"send_default_pii": True,
"environment": ENVIRONMENT,
"before_send": sentry_filter,
"integrations": [DjangoIntegration(), CeleryIntegration()]
if DjangoIntegration and CeleryIntegration
else [],

View file

@ -1,15 +1,10 @@
import os
from dotenv import load_dotenv
from .version import get_current_version
from .base import * # isort:skip
load_dotenv()
DEBUG = False
ALLOWED_HOSTS = ["rss.fudiggity.nl"]
@ -83,7 +78,9 @@ REGISTRATION_OPEN = False
try:
from sentry_sdk import init as sentry_init
SENTRY_CONFIG.update({"release": VERSION, "environment": ENVIRONMENT})
SENTRY_CONFIG.update(
{"release": VERSION, "environment": ENVIRONMENT, "debug": False}
)
sentry_init(**SENTRY_CONFIG)
except ImportError:

View file

@ -9,7 +9,7 @@ def get_current_version(debug=True):
if debug:
try:
output = subprocess.check_output(
["git", "show", "--no-patch", "--format=%s"], universal_newlines=True
["git", "show", "--no-patch", "--format=%H"], universal_newlines=True
)
return output.strip()
except (subprocess.CalledProcessError, OSError):