113c1e731d300b819e580069de11ce4038645a71
[wolnelektury.git] / src / wolnelektury / settings / __init__.py
1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
3 #
4 # Django settings for wolnelektury project.
5 import sentry_sdk
6 from sentry_sdk.integrations.django import DjangoIntegration
7
8 from .apps import *
9 from .basic import *
10 from .auth import *
11 from .celery import *
12 from .contrib import *
13 from .custom import *
14 from .locale import *
15 from .static import *
16 from .paths import *
17
18 # Load localsettings, if they exist
19 try:
20     from wolnelektury.localsettings import *
21 except ImportError:
22     pass
23
24
25 # If Celery broker not configured, enable always-eager mode.
26 try:
27     CELERY_BROKER_URL
28 except NameError:
29     CELERY_TASK_ALWAYS_EAGER = True
30
31
32 # If SEARCH_INDEX not configured, disable the search.
33 try:
34     SOLR
35 except NameError:
36     NO_SEARCH_INDEX = True
37 else:
38     NO_SEARCH_INDEX = False
39
40
41 try:
42     SENTRY_DSN
43 except NameError:
44     pass
45 else:
46     sentry_sdk.init(
47         dsn=SENTRY_DSN,
48         integrations=[DjangoIntegration()]
49     )
50
51
52 # Dummy secret key for development.
53 try:
54     SECRET_KEY
55 except NameError:
56     if DEBUG:
57         SECRET_KEY = 'not-a-secret-key'