<commit_before>import os
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
import logging

rel = lambda *x: os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)

''' 
SITE SPECIFIC CONFIGURATION
These parameters are read from file 'cog_settings.cfg' 
located in directory COG_CONFIG_DIR (or by default '/usr/local/cog/cog_config').
Each parameter has a default value.
'''

SECTION_DEFAULT = 'DEFAULT'
SECTION_ESGF = 'ESGF'
SECTION_EMAIL = 'EMAIL'

from cog.site_manager import siteManager

COG_CONFIG_DIR = os.environ.get('COG_CONFIG_DIR', '/usr/local/cog/cog_config')

SITE_NAME = siteManager.get('SITE_NAME', default='Local CoG')
SITE_DOMAIN = siteManager.get('SITE_DOMAIN', default='localhost:8000')
TIME_ZONE = siteManager.get('TIME_ZONE', default='America/Denver')
COG_MAILING_LIST = siteManager.get('COG_MAILING_LIST', default='<EMAIL>')
SECRET_KEY = siteManager.get('SECRET_KEY', default='ds4sjjj(76K=={%$HHH1@#b:l;')
# for SQLLite back-end
DATABASE_PATH = siteManager.get('DATABASE_PATH', default="%s/django.data" % COG_CONFIG_DIR)
# for postgres back-end
DATABASE_NAME = siteManager.get('DATABASE_NAME', default='cogdb')
DATABASE_USER = siteManager.get('DATABASE_USER')
DATABASE_PASSWORD = siteManager.get('DATABASE_PASSWORD')
DATABASE_PORT = siteManager.get('DATABASE_PORT', default=5432)
MY_PROJECTS_REFRESH_SECONDS = int(siteManager.get('MY_PROJECTS_REFRESH_SECONDS', default=3600)) # one hour 
PASSWORD_EXPIRATION_DAYS = int(siteManager.get('PASSWORD_EXPIRATION_DAYS', default=0)) # 0: no expiration
IDP_REDIRECT = siteManager.get('IDP_REDIRECT', default=None)
HOME_PROJECT = siteManager.get('HOME_PROJECT', default='cog')
MEDIA_ROOT = siteManager.get('MEDIA_ROOT', default="%s/site_media" % COG_CONFIG_DIR)
DEFAULT_SEARCH_URL = siteManager.get('DEFAULT_SEARCH_URL', default='http://hydra.fsl.noaa.gov/esg-search/search/')
DJANGO_DATABASE = siteManager.get('DJANGO_DATABASE', default='sqllite3')
DEBUG = bool( siteManager.get('DEBUG', default='False') )
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = siteManager.get('ALLOWED_HOSTS').split(",")
print 'Using DEBUG=%s ALLOWED_HOSTS=%s' % (DEBUG, ALLOWED_HOSTS)

# FIXME
# ESGF specific settings
ESGF_CONFIG = siteManager.hasConfig(SECTION_ESGF)
if ESGF_CONFIG:<commit_msg>Fixing problem with boolean conversion.<commit_after>import os
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS
import logging

rel = lambda *x: os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)

''' 
SITE SPECIFIC CONFIGURATION
These parameters are read from file 'cog_settings.cfg' 
located in directory COG_CONFIG_DIR (or by default '/usr/local/cog/cog_config').
Each parameter has a default value.
'''

SECTION_DEFAULT = 'DEFAULT'
SECTION_ESGF = 'ESGF'
SECTION_EMAIL = 'EMAIL'

from cog.site_manager import siteManager

COG_CONFIG_DIR = os.environ.get('COG_CONFIG_DIR', '/usr/local/cog/cog_config')

SITE_NAME = siteManager.get('SITE_NAME', default='Local CoG')
SITE_DOMAIN = siteManager.get('SITE_DOMAIN', default='localhost:8000')
TIME_ZONE = siteManager.get('TIME_ZONE', default='America/Denver')
COG_MAILING_LIST = siteManager.get('COG_MAILING_LIST', default='<EMAIL>')
SECRET_KEY = siteManager.get('SECRET_KEY', default='ds4sjjj(76K=={%$HHH1@#b:l;')
# for SQLLite back-end
DATABASE_PATH = siteManager.get('DATABASE_PATH', default="%s/django.data" % COG_CONFIG_DIR)
# for postgres back-end
DATABASE_NAME = siteManager.get('DATABASE_NAME', default='cogdb')
DATABASE_USER = siteManager.get('DATABASE_USER')
DATABASE_PASSWORD = siteManager.get('DATABASE_PASSWORD')
DATABASE_PORT = siteManager.get('DATABASE_PORT', default=5432)
MY_PROJECTS_REFRESH_SECONDS = int(siteManager.get('MY_PROJECTS_REFRESH_SECONDS', default=3600)) # one hour 
PASSWORD_EXPIRATION_DAYS = int(siteManager.get('PASSWORD_EXPIRATION_DAYS', default=0)) # 0: no expiration
IDP_REDIRECT = siteManager.get('IDP_REDIRECT', default=None)
HOME_PROJECT = siteManager.get('HOME_PROJECT', default='cog')
MEDIA_ROOT = siteManager.get('MEDIA_ROOT', default="%s/site_media" % COG_CONFIG_DIR)
DEFAULT_SEARCH_URL = siteManager.get('DEFAULT_SEARCH_URL', default='http://hydra.fsl.noaa.gov/esg-search/search/')
DJANGO_DATABASE = siteManager.get('DJANGO_DATABASE', default='sqllite3')
if siteManager.get('DEBUG', default='False').lower() == 'true':
    DEBUG = True
else:
    DEBUG = False
TEMPLATE_DEBUG = DEBUG
ALLOWED_HOSTS = siteManager.get('ALLOWED_HOSTS').split(",")
print 'Using DEBUG=%s ALLOWED_HOSTS=%s' % (DEBUG, ALLOWED_HOSTS)

# FIXME
# ESGF specific settings
ESGF_CONFIG = siteManager.hasConfig(SECTION_ESGF)
if ESGF_CONFIG:
{'fraction_non_alphanumeric': 0.13436748962202316, 'fraction_numerical': 0.008302381472580292, 'mean_word_length': 8.137724550898204, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3974363', 'n_tokens_mistral': 1721, 'n_tokens_neox': 1694, 'n_words': 278}