try: if not BASE_URL: raise RuntimeError('Local setting BASE_URL should be non-empty') except NameError as e: raise RuntimeError('BASE_URL must be specified in local settings') from e # update INSTALLED_APPS if 'INSTALLED_LOGIN_APPS' in globals(): INSTALLED_APPS = INSTALLED_LOGIN_APPS + INSTALLED_APPS # update template loaders for production use_cache_template_loader_in_production(__name__) # setup authentication backends based on installed_apps SOCIAL_AUTH = False AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', ) if 'shibboleth_login' in INSTALLED_APPS: AUTHENTICATION_BACKENDS += ( 'shibboleth_login.auth_backend.ShibbolethAuthBackend', ) if 'social_django' in INSTALLED_APPS: SOCIAL_AUTH = True AUTHENTICATION_BACKENDS += ('social_core.backends.google.GoogleOAuth2', ) if DEBUG: # Allow basic auth for API when DEBUG is on REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] += ( 'rest_framework.authentication.BasicAuthentication', ) # Enable defer logging from lib.models import install_defer_logger install_defer_logger()
raise RuntimeError('Local setting BASE_URL should be non-empty') except NameError as e: raise RuntimeError('BASE_URL must be specified in local settings') from e # update INSTALLED_APPS if 'INSTALLED_LOGIN_APPS' in globals(): INSTALLED_APPS = INSTALLED_LOGIN_APPS + INSTALLED_APPS # update template loaders for production use_cache_template_loader_in_production(__name__) # setup authentication backends based on installed_apps SOCIAL_AUTH = False AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', ) if 'shibboleth_login' in INSTALLED_APPS: AUTHENTICATION_BACKENDS += ('shibboleth_login.auth_backend.ShibbolethAuthBackend',) if 'social_django' in INSTALLED_APPS: SOCIAL_AUTH = True AUTHENTICATION_BACKENDS += ('social_core.backends.google.GoogleOAuth2',) if DEBUG: # Allow basic auth for API when DEBUG is on REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES'] += ('rest_framework.authentication.BasicAuthentication',) # Enable defer logging from lib.models import install_defer_logger install_defer_logger()