Load dotenv on all environments
This commit is contained in:
parent
f326a4c923
commit
b106ebf827
3 changed files with 10 additions and 7 deletions
|
|
@ -2,10 +2,15 @@ import os
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from sentry_sdk.integrations.celery import CeleryIntegration
|
from sentry_sdk.integrations.celery import CeleryIntegration
|
||||||
from sentry_sdk.integrations.django import DjangoIntegration
|
from sentry_sdk.integrations.django import DjangoIntegration
|
||||||
|
from .sentry import sentry_filter
|
||||||
except ImportError:
|
except ImportError:
|
||||||
CeleryIntegration = None
|
CeleryIntegration = None
|
||||||
DjangoIntegration = None
|
DjangoIntegration = None
|
||||||
|
|
@ -258,6 +263,7 @@ SENTRY_CONFIG = {
|
||||||
"dsn": os.environ.get("SENTRY_DSN"),
|
"dsn": os.environ.get("SENTRY_DSN"),
|
||||||
"send_default_pii": True,
|
"send_default_pii": True,
|
||||||
"environment": ENVIRONMENT,
|
"environment": ENVIRONMENT,
|
||||||
|
"before_send": sentry_filter,
|
||||||
"integrations": [DjangoIntegration(), CeleryIntegration()]
|
"integrations": [DjangoIntegration(), CeleryIntegration()]
|
||||||
if DjangoIntegration and CeleryIntegration
|
if DjangoIntegration and CeleryIntegration
|
||||||
else [],
|
else [],
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,10 @@
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
from .version import get_current_version
|
from .version import get_current_version
|
||||||
|
|
||||||
|
|
||||||
from .base import * # isort:skip
|
from .base import * # isort:skip
|
||||||
|
|
||||||
|
|
||||||
load_dotenv()
|
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
|
|
||||||
ALLOWED_HOSTS = ["rss.fudiggity.nl"]
|
ALLOWED_HOSTS = ["rss.fudiggity.nl"]
|
||||||
|
|
@ -83,7 +78,9 @@ REGISTRATION_OPEN = False
|
||||||
try:
|
try:
|
||||||
from sentry_sdk import init as sentry_init
|
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)
|
sentry_init(**SENTRY_CONFIG)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ def get_current_version(debug=True):
|
||||||
if debug:
|
if debug:
|
||||||
try:
|
try:
|
||||||
output = subprocess.check_output(
|
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()
|
return output.strip()
|
||||||
except (subprocess.CalledProcessError, OSError):
|
except (subprocess.CalledProcessError, OSError):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue