try: with open(os.path.join(TETHYS_HOME, 'portal_config.yml')) as portal_yaml: portal_config_settings = yaml.safe_load(portal_yaml).get('settings', {}) or {} except FileNotFoundError: log.info('Could not find the portal_config.yml file. To generate a new portal_config.yml run the command ' '"tethys gen portal_config"') except Exception: log.exception('There was an error while attempting to read the settings from the portal_config.yml file.') bokeh_settings.resources = portal_config_settings.pop('BOKEH_RESOURCES', 'cdn') # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = portal_config_settings.pop('SECRET_KEY', generate_secret_key()) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = portal_config_settings.pop('DEBUG', True) ALLOWED_HOSTS = portal_config_settings.pop('ALLOWED_HOSTS', []) # List those who should be notified of an error when DEBUG = False as a tuple of (name, email address). # i.e.: ADMINS = (('John', '*****@*****.**'), ('Mary', '*****@*****.**')) ADMINS = portal_config_settings.pop('ADMINS', ()) TETHYS_PORTAL_CONFIG = portal_config_settings.pop('TETHYS_PORTAL_CONFIG', {}) # Use this setting to bypass the home page BYPASS_TETHYS_HOME_PAGE = TETHYS_PORTAL_CONFIG.pop('BYPASS_TETHYS_HOME_PAGE', False) # Use this setting to disable open account signup
with open(os.path.join(TETHYS_HOME, 'portal_config.yml')) as portal_yaml: local_settings = yaml.safe_load(portal_yaml).get('settings', {}) or {} except FileNotFoundError: log.info( 'Could not find the portal_config.yml file. To generate a new portal_config.yml run the command ' '"tethys gen portal_config"') except Exception: log.exception( 'There was an error while attempting to read the settings from the portal_config.yml file.' ) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.9/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = local_settings.pop('SECRET_KEY', generate_secret_key()) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = local_settings.pop('DEBUG', True) ALLOWED_HOSTS = local_settings.pop('ALLOWED_HOSTS', []) # List those who should be notified of an error when DEBUG = False as a tuple of (name, email address). # i.e.: ADMINS = (('John', '*****@*****.**'), ('Mary', '*****@*****.**')) ADMINS = local_settings.pop('ADMINS', ()) # Use this setting to bypass the home page BYPASS_TETHYS_HOME_PAGE = local_settings.pop('BYPASS_TETHYS_HOME_PAGE', False) # Use this setting to disable open account signup ENABLE_OPEN_SIGNUP = local_settings.pop('ENABLE_OPEN_SIGNUP', False)