X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/6d42bc478e3d1bd90eb294464748c21e4de0fc63..1b80c204be885588f7cbe95610e3677f2f886801:/src/wolnelektury/settings/__init__.py diff --git a/src/wolnelektury/settings/__init__.py b/src/wolnelektury/settings/__init__.py index 4cab2b136..f8451cc23 100644 --- a/src/wolnelektury/settings/__init__.py +++ b/src/wolnelektury/settings/__init__.py @@ -2,6 +2,9 @@ # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # # Django settings for wolnelektury project. +import sentry_sdk +from sentry_sdk.integrations.django import DjangoIntegration + from .apps import * from .basic import * from .auth import * @@ -18,3 +21,38 @@ try: from wolnelektury.localsettings import * except ImportError: pass + + +# If Celery broker not configured, enable always-eager mode. +try: + CELERY_BROKER_URL +except NameError: + CELERY_TASK_ALWAYS_EAGER = True + + +# If SEARCH_INDEX not configured, disable the search. +try: + SOLR +except NameError: + NO_SEARCH_INDEX = True +else: + NO_SEARCH_INDEX = False + + +try: + SENTRY_DSN +except NameError: + pass +else: + sentry_sdk.init( + dsn=SENTRY_DSN, + integrations=[DjangoIntegration()] + ) + + +# Dummy secret key for development. +try: + SECRET_KEY +except NameError: + if DEBUG: + SECRET_KEY = 'not-a-secret-key'