X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/875efc3090b43807d41438a98f3e84ceafecab51..f8e9dec8c109a74eed190b03655ef6b3b8bcbfdc:/src/wolnelektury/settings/__init__.py?ds=sidebyside diff --git a/src/wolnelektury/settings/__init__.py b/src/wolnelektury/settings/__init__.py index 78b556d78..8d5b33b8f 100644 --- a/src/wolnelektury/settings/__init__.py +++ b/src/wolnelektury/settings/__init__.py @@ -1,9 +1,13 @@ -# -*- coding: utf-8 -*- +# This file is part of Wolne Lektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Wolne Lektury. 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 * -from .cache import * from .celery import * from .contrib import * from .custom import * @@ -16,3 +20,29 @@ 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 + + +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'