<commit_before>from django.utils.translation import gettext_lazy as _
import os
import logging
from django.utils.log import DEFAULT_LOGGING
from decouple import AutoConfig, Csv
from pathlib import Path

mpl_logger = logging.getLogger('matplotlib')
mpl_logger.setLevel(logging.WARNING) 

logger = logging.getLogger(__name__)

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

CONFIG_DIR = Path(BASE_DIR + "/..")
config = AutoConfig(search_path = CONFIG_DIR)

DEBUG = config('DEBUG', default=True, cast=bool)

DEBUG_HTTPS = config('DEBUG_HTTPS', default=False, cast=bool)

LOG_LEVEL = config('LOG_LEVEL', default='DEBUG')

DICT_CONFIG = {
    "version": 1,
    "disable_existing_loggers": False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse',
        },
        'require_debug_true': {
            '()': 'django.utils.log.RequireDebugTrue',
        },
    },
    "formatters": {
        "default": {
            "format": "%(asctime)s %(name)s %(pathname)s:%(lineno)s:%(funcName)s %(levelname)s %(message)s",
        },
        "django.server": DEFAULT_LOGGING['formatters']['django.server'],
    },

    "handlers": {
        'console': {
            'level': LOG_LEVEL,
            'class': 'logging.StreamHandler',
            'formatter': 'default',
            'filters': ['require_debug_true'],
    },

        "console_debug_false": {
            "level": LOG_LEVEL,
            "filters": ["require_debug_false"],
            "class": "logging.StreamHandler",
        },

        "mail_admins": {
            "level": "ERROR",
            "filters": ["require_debug_false"],
            "class": "django.utils.log.AdminEmailHandler"
        },
        
        "django.server": DEFAULT_LOGGING["handlers"]["django.server"],

    },

    "loggers": {
        '': {
            'level': LOG_LEVEL,
            'handlers': ['console', 'console_debug_false'],
            'propagate': False,
        },
        "django": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "bot.stream": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "bot.tasks": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "bot.doctoctocbot": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "messenger.tasks": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "tagging.tasks": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "timeline": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "django-invitations": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "bot.bin.thread": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "moderation.tasks": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "moderation.moderate": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "moderation.social": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "request.tasks": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "dm": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "django.server": DEFAULT_LOGGING["loggers"]["django.server"],
    },
}
logging.config.dictConfig(DICT_CONFIG)

#sys.path.append(os.path.dirname(os.path.abspath(__file__)))





SECRET_KEY = config('SECRET_KEY')

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv(), default="*")

if not DEBUG or DEBUG_HTTPS:
    SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

SITE_ID = config('SITE_ID_1', cast=int, default=1)

# WAGTAIL
WAGTAIL_SITE_NAME = config('WAGTAIL_SITE_NAME')
WAGTAIL_FRONTEND_LOGIN_URL = '/accounts/login/'

# Application definition

INSTALLED_APPS = [
    'invitations',
    'users',
    'modeltranslation',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',<commit_msg>allow https in DEBUG mode<commit_after>from django.utils.translation import gettext_lazy as _
import os
import logging
from django.utils.log import DEFAULT_LOGGING
from decouple import AutoConfig, Csv
from pathlib import Path

mpl_logger = logging.getLogger('matplotlib')
mpl_logger.setLevel(logging.WARNING) 

logger = logging.getLogger(__name__)

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

CONFIG_DIR = Path(BASE_DIR + "/..")
config = AutoConfig(search_path = CONFIG_DIR)

DEBUG = config('DEBUG', default=True, cast=bool)

DEBUG_HTTPS = config('DEBUG_HTTPS', default=False, cast=bool)

LOG_LEVEL = config('LOG_LEVEL', default='DEBUG')

DICT_CONFIG = {
    "version": 1,
    "disable_existing_loggers": False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse',
        },
        'require_debug_true': {
            '()': 'django.utils.log.RequireDebugTrue',
        },
    },
    "formatters": {
        "default": {
            "format": "%(asctime)s %(name)s %(pathname)s:%(lineno)s:%(funcName)s %(levelname)s %(message)s",
        },
        "django.server": DEFAULT_LOGGING['formatters']['django.server'],
    },

    "handlers": {
        'console': {
            'level': LOG_LEVEL,
            'class': 'logging.StreamHandler',
            'formatter': 'default',
            'filters': ['require_debug_true'],
    },

        "console_debug_false": {
            "level": LOG_LEVEL,
            "filters": ["require_debug_false"],
            "class": "logging.StreamHandler",
        },

        "mail_admins": {
            "level": "ERROR",
            "filters": ["require_debug_false"],
            "class": "django.utils.log.AdminEmailHandler"
        },
        
        "django.server": DEFAULT_LOGGING["handlers"]["django.server"],

    },

    "loggers": {
        '': {
            'level': LOG_LEVEL,
            'handlers': ['console', 'console_debug_false'],
            'propagate': False,
        },
        "django": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "bot.stream": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "bot.tasks": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "bot.doctoctocbot": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "messenger.tasks": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "tagging.tasks": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "timeline": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "django-invitations": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "bot.bin.thread": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "moderation.tasks": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "moderation.moderate": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "moderation.social": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "request.tasks": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "dm": {
            "handlers": ["console", "console_debug_false", "mail_admins"],
            "level": LOG_LEVEL,
        },
        "django.server": DEFAULT_LOGGING["loggers"]["django.server"],
    },
}
logging.config.dictConfig(DICT_CONFIG)

#sys.path.append(os.path.dirname(os.path.abspath(__file__)))





SECRET_KEY = config('SECRET_KEY')

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/

ALLOWED_HOSTS = config('ALLOWED_HOSTS', cast=Csv(), default="*")

if not DEBUG or DEBUG_HTTPS:
    SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
    ABSOLUTEURI_PROTOCOL = 'https'

SITE_ID = config('SITE_ID_1', cast=int, default=1)

# WAGTAIL
WAGTAIL_SITE_NAME = config('WAGTAIL_SITE_NAME')
WAGTAIL_FRONTEND_LOGIN_URL = '/accounts/login/'

# Application definition

INSTALLED_APPS = [
    'invitations',
    'users',
    'modeltranslation',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
{'fraction_non_alphanumeric': 0.16045702930948832, 'fraction_numerical': 0.0009935419771485345, 'mean_word_length': 2.5568904593639576, 'pattern_counts': {'":': 120, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3711995', 'n_tokens_mistral': 3225, 'n_tokens_neox': 3148, 'n_words': 505}