# -*- coding: utf-8 -*-
'''Consolidates settings from defaults.py and local.py.

::
    >>> from api.base import settings
    >>> settings.API_BASE
    'v2/'
'''
import os
import warnings
import itertools

from .defaults import *  # noqa
from website.settings import DEV_MODE

try:
    from .local import *  # noqa
except ImportError as error:
    warnings.warn('No api/base/settings/local.py settings file found. Did you remember to '
                  'copy local-dist.py to local.py?', ImportWarning)

if not DEV_MODE and os.environ.get('DJANGO_SETTINGS_MODULE') == 'api.base.settings':
    from . import local
    from . import defaults
    for setting in ('JWE_SECRET', 'JWT_SECRET', 'BYPASS_THROTTLE_TOKEN'):
        assert getattr(local, setting, None) and getattr(local, setting, None) != getattr(defaults, setting, None), '{} must be specified in local.py when DEV_MODE is False'.format(setting)

def load_institutions():
    global INSTITUTION_ORIGINS_WHITELIST
    from osf import models
    INSTITUTION_ORIGINS_WHITELIST = tuple(domain.lower() for domain in itertools.chain(*[
        institution.domains
        for institution in models.Institution.find()
    ]))

@@ -234,46 +234,8 @@
 noqa
-%0Afrom website.settings import DEV_MODE
 %0A%0Atr
@@ -469,22 +469,19 @@
 f not DE
-V_MODE
+BUG
  and os.
@@ -828,14 +828,11 @@
 n DE
-V_MODE
+BUG
  is 

apply DEBUG mode for api required settings