<commit_before>"""
Production-ready deployment settings

"""
from project.project.defaults import *

# Choose which site we're using. initial_data.yaml installs some
# fixture data so that localhost:8000 has SIDE_ID == 1, and
# h4h.mst.edu has SITE_ID == 2
#
# Since we're deploying on h4h.mst.edu, SITE_ID should be 2.
SITE_ID = 2

ALLOWED_HOSTS = ["h4h.mst.edu"]


# Since we're behind a proxy
USE_X_FORWARDED_HOST = True


##########################################################################
#
# Database
#
##########################################################################

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': POSTGRES_DB,            # Should be in secret_settings.py
        'USER': POSTGRES_USER,          # Should be in secret_settings.py
        'PASSWORD': <PASSWORD>,  # Should be in secret_settings.py
        'HOST': 'localhost'
    }
}

##########################################################################
#
# Templates
#
##########################################################################

# Debug templates
for t in TEMPLATES:
    t["OPTIONS"]["debug"] = False


##########################################################################
#
# Cache
#
##########################################################################

# CACHES = { }


##########################################################################
#
# Logging
#
##########################################################################

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'root': {
        'level': 'WARNING',
        'handlers': ['sentry', 'console', 'logfile'],
    },
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
        },
        'simple': {
            'format': '%(levelname)s %(message)s'
        },
    },
    'handlers': {
        'sentry': {
            'level': 'WARNING',
            'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
        },
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'verbose'
        },
        'logfile': {
            'level':'DEBUG',
            'class':'logging.handlers.RotatingFileHandler',
            'filename': os.path.join(VAR_DIR, "logs", "log.txt"),
            'maxBytes': 50000,
            'backupCount': 2,
            'formatter': 'verbose',
        },
    },
    'loggers': {
        'raven': {
            'level': 'DEBUG',
            'handlers': ['console'],
            'propagate': False,
        },
        'sentry.errors': {
            'level': 'DEBUG',
            'handlers': ['console'],
            'propagate': False,
        },

        # Log all debug information for our apps to stdout and to a file
        'webserver': {
            'level': 'DEBUG',
            'handlers': ['console', 'logfile'],
            'propagate': True,
        },
        'competition': {
            'level': 'DEBUG',
            'handlers': ['console', 'logfile'],
            'propagate': True,
        }
    }
}
<commit_msg>Catch 404's with Raven<commit_after>"""
Production-ready deployment settings

"""
from project.project.defaults import *

# Choose which site we're using. initial_data.yaml installs some
# fixture data so that localhost:8000 has SIDE_ID == 1, and
# h4h.mst.edu has SITE_ID == 2
#
# Since we're deploying on h4h.mst.edu, SITE_ID should be 2.
SITE_ID = 2

ALLOWED_HOSTS = ["h4h.mst.edu"]


# Since we're behind a proxy
USE_X_FORWARDED_HOST = True


##########################################################################
#
# Database
#
##########################################################################

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': POSTGRES_DB,            # Should be in secret_settings.py
        'USER': POSTGRES_USER,          # Should be in secret_settings.py
        'PASSWORD': <PASSWORD>,  # Should be in secret_settings.py
        'HOST': 'localhost'
    }
}

##########################################################################
#
# Templates
#
##########################################################################

# Debug templates
for t in TEMPLATES:
    t["OPTIONS"]["debug"] = False


##########################################################################
#
# Cache
#
##########################################################################

# CACHES = { }


##########################################################################
#
# Logging
#
##########################################################################

MIDDLEWARE_CLASSES = (
    'raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware',
) + MIDDLEWARE_CLASSES

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'root': {
        'level': 'WARNING',
        'handlers': ['sentry', 'console', 'logfile'],
    },
    'formatters': {
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
        },
        'simple': {
            'format': '%(levelname)s %(message)s'
        },
    },
    'handlers': {
        'sentry': {
            'level': 'WARNING',
            'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
        },
        'console': {
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
            'formatter': 'verbose'
        },
        'logfile': {
            'level':'DEBUG',
            'class':'logging.handlers.RotatingFileHandler',
            'filename': os.path.join(VAR_DIR, "logs", "log.txt"),
            'maxBytes': 50000,
            'backupCount': 2,
            'formatter': 'verbose',
        },
    },
    'loggers': {
        'raven': {
            'level': 'DEBUG',
            'handlers': ['console'],
            'propagate': False,
        },
        'sentry.errors': {
            'level': 'DEBUG',
            'handlers': ['console'],
            'propagate': False,
        },

        # Log all debug information for our apps to stdout and to a file
        'webserver': {
            'level': 'DEBUG',
            'handlers': ['console', 'logfile'],
            'propagate': True,
        },
        'competition': {
            'level': 'DEBUG',
            'handlers': ['console', 'logfile'],
            'propagate': True,
        }
    }
}

{'fraction_non_alphanumeric': 0.31080043017360576, 'fraction_numerical': 0.006759870947918267, 'mean_word_length': 2.6348408710217757, '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': '3601756', 'n_tokens_mistral': 1901, 'n_tokens_neox': 1791, 'n_words': 366}