Start updating docs.
[wolnelektury.git] / src / wolnelektury / settings / __init__.py
index 78b556d..f8451cc 100644 (file)
@@ -1,5 +1,10 @@
-# -*- coding: utf-8 -*-
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# 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 *
@@ -16,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'