diff --git a/.env.example b/.env.example index de151e2..80f4bf8 100644 --- a/.env.example +++ b/.env.example @@ -21,4 +21,6 @@ DB_NAME = 'collector_db' REDIS_HOST = 'redis' REDIS_PORT = 6379 -REDIS_URI = 'redis://redis:6379/' \ No newline at end of file +REDIS_URI = 'redis://redis:6379/' + +SENTRY_IO_DNS = \ No newline at end of file diff --git a/src/collectorapp/config.py b/src/collectorapp/config.py index 63237c9..a0ec34e 100644 --- a/src/collectorapp/config.py +++ b/src/collectorapp/config.py @@ -39,3 +39,7 @@ SOCIAL_AUTH_TWITTER_SECRET = TWITTER_SECRETS['consumer_secret'] SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/home/' SOCIAL_AUTH_LOGIN_URL = 'login/' + + +# SENTRY.IO +SENTRY_IO_DNS = os.environ.get("SENTRY_IO_DNS") diff --git a/src/collectorapp/sentry.py b/src/collectorapp/sentry.py new file mode 100644 index 0000000..0f1aaf8 --- /dev/null +++ b/src/collectorapp/sentry.py @@ -0,0 +1,21 @@ + + +import sentry_sdk +from sentry_sdk.integrations.django import DjangoIntegration + +from .config import SENTRY_IO_DNS + +if SENTRY_IO_DNS: + sentry_sdk.init( + dsn=SENTRY_IO_DNS, + integrations=[DjangoIntegration()], + + # Set traces_sample_rate to 1.0 to capture 100% + # of transactions for performance monitoring. + # We recommend adjusting this value in production. + traces_sample_rate=1.0, + + # If you wish to associate users to errors (assuming you are using + # django.contrib.auth) you may enable sending PII data. + send_default_pii=True + ) diff --git a/src/collectorapp/settings.py b/src/collectorapp/settings.py index cd3c604..7e603de 100644 --- a/src/collectorapp/settings.py +++ b/src/collectorapp/settings.py @@ -1,6 +1,7 @@ -# import all config variables import os +import collectorapp.sentry + from .config import * if APP_ENV == 'dev': diff --git a/src/requirements.txt b/src/requirements.txt index 1aa32fd..f9df82b 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -23,4 +23,5 @@ mysqlclient==2.1.0 itsdangerous==1.1.0 argon2-cffi==21.3.0 Celery==5.2.3 -pyppeteer==1.0.2 \ No newline at end of file +pyppeteer==1.0.2 +sentry-sdk==1.5.7 \ No newline at end of file diff --git a/src/templates/posts/pdf.html b/src/templates/posts/pdf.html index 2934099..faa3ffa 100644 --- a/src/templates/posts/pdf.html +++ b/src/templates/posts/pdf.html @@ -45,7 +45,7 @@
- {{post.content|safe}} + {{post.content|safe|linebreaks}}
diff --git a/src/templates/posts/post.html b/src/templates/posts/post.html index 86a7f73..02f3400 100644 --- a/src/templates/posts/post.html +++ b/src/templates/posts/post.html @@ -72,7 +72,7 @@ - {{post.content|safe}} + {{post.content|safe|linebreaks}}