__init__.py 1.12 KB
Newer Older
1
2
3
4
5
6
7
8
"""
Settings module

This file controls what settings are loaded.

Using environment variables you can control the loading of various
overrides.
"""
Thom Wiggers's avatar
Thom Wiggers committed
9
10
# flake8: noqa: ignore F403

11
from firebase_admin import initialize_app, credentials
12
13
14

# Load all default settings because we need to use settings.configure
# for sphinx documentation generation.
15
from django.conf.global_settings import *  # pylint: disable=wildcard-import
16

17
# Load base settings
18
from .settings import *  # pylint: disable=wildcard-import
19
20

# Attempt to load local overrides
Thom Wiggers's avatar
Thom Wiggers committed
21
try:
22
    from .localsettings import *  # pylint: disable=wildcard-import
Thom Wiggers's avatar
Thom Wiggers committed
23
24
except ImportError:
    pass
Thom Wiggers's avatar
Thom Wiggers committed
25

26
27
# Load production settings if DJANGO_PRODUCTION is set
if os.environ.get('DJANGO_PRODUCTION'):  # pragma: nocover
28
    from .production import *  # pylint: disable=wildcard-import
29
30
31

# Load testing settings if GITLAB_CI is set
if os.environ.get('GITLAB_CI'):  # pragma: nocover
32
    from .testing import *  # pylint: disable=wildcard-import
33
34
35
36
37
38

try:
    initialize_app(
        credential=credentials.Certificate(FIREBASE_CREDENTIALS))
except ValueError as e:
    print('Firebase application failed to initialise')