|
10 | 10 | https://docs.djangoproject.com/en/4.2/ref/settings/
|
11 | 11 | """
|
12 | 12 | import os
|
| 13 | +import sentry_sdk |
13 | 14 | from pathlib import Path
|
14 | 15 | from typing import Any
|
15 | 16 |
|
| 17 | +# Sentry init and config: |
| 18 | +# - If you want to use Sentry, specify the DSN via the env var of `SENTRY_DSN`. |
| 19 | +# - Useful defaults for a development environment are set below. They can be |
| 20 | +# changed by modifying env vars. |
| 21 | +from sentry_sdk.integrations.django import DjangoIntegration |
| 22 | +from sentry_sdk.integrations.redis import RedisIntegration |
| 23 | + |
| 24 | +SENTRY_DSN = os.environ.get('SENTRY_DSN') |
| 25 | +if SENTRY_DSN: |
| 26 | + sentry_sdk.init( |
| 27 | + dsn=SENTRY_DSN, |
| 28 | + integrations=[DjangoIntegration(), RedisIntegration(max_data_size=0)], |
| 29 | + traces_sample_rate=os.environ.get('SENTRY_TRACES_SAMPLE_RATE', 1.0), |
| 30 | + profiles_sample_rate=os.environ.get('SENTRY_PROFILES_SAMPLE_RATE', 1.0), |
| 31 | + environment=os.environ.get('SENTRY_ENVIRONMENT', 'development'), |
| 32 | + debug=os.environ.get('SENTRY_DEBUG', 'True'), |
| 33 | + attach_stacktrace=os.environ.get('SENTRY_ATTACH_STACKTRACE', 'True') |
| 34 | + ) |
| 35 | + |
| 36 | + |
16 | 37 | # Build paths inside the project like this: BASE_DIR / 'subdir'.
|
17 | 38 | BASE_DIR: Path = Path(__file__).resolve().parent.parent
|
18 | 39 |
|
|
131 | 152 |
|
132 | 153 | # Django chache
|
133 | 154 | # https://docs.djangoproject.com/en/4.2/topics/cache/#redis
|
| 155 | + |
134 | 156 | CACHES: dict[str, dict[str, str]] = {
|
135 | 157 | 'default': {
|
136 | 158 | 'BACKEND': 'django.core.cache.backends.redis.RedisCache',
|
|
0 commit comments