<commit_before># -*- coding: utf-8 -*-

# Django settings for the mozillians project.
import json
import os.path
import sys

from django.utils.functional import lazy

from decouple import config, Csv
from unipath import Path
from dj_database_url import parse as db_url
from django_jinja.builtins import DEFAULT_EXTENSIONS
from urlparse import urljoin

PROJECT_MODULE = 'mozillians'
# Root path of the project
ROOT = Path(__file__).parent
# Defines the views served for root URLs.
ROOT_URLCONF = '%s.urls' % PROJECT_MODULE
# Absolute path to the directory that holds media.
MEDIA_ROOT = Path('media').resolve()
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
MEDIA_URL = config('MEDIA_URL', default='/media/')
# Absolute path to the directory static files should be collected to.
STATIC_ROOT = Path('static').resolve()
# URL prefix for static files served via whitenoise
STATIC_HOST = config('STATIC_HOST', default='')
# URL prefix for static files.
STATIC_URL = STATIC_HOST + '/static/'

# Application definition
########################
INSTALLED_APPS = (
    'dal',
    'dal_select2',

    # Django contrib apps
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.staticfiles',
    'django.contrib.messages',
    'django.contrib.admin',

    # Third-party apps, patches, fixes
    'django_jinja',
    'puente',
    'compressor',
    'cronjobs',
    'django_nose',
    'session_csrf',
    'product_details',
    'csp',
    'mozilla_django_oidc',
    'cities_light',
    'axes',
    'haystack',
    'graphene_django',

    'mozillians',
    'mozillians.users',
    'mozillians.phonebook',
    'mozillians.groups',
    'mozillians.common',
    'mozillians.api',
    'mozillians.mozspaces',
    'mozillians.funfacts',
    'mozillians.announcements',
    'mozillians.humans',
    'mozillians.geo',
    'mozillians.graphql_profiles',
    'mozillians.dino_park',

    'sorl.thumbnail',
    'import_export',
    'waffle',
    'rest_framework',
    'django_filters',
    'raven.contrib.django.raven_compat',
)

MIDDLEWARE = [
    'whitenoise.middleware.WhiteNoiseMiddleware',

    'django.middleware.common.CommonMiddleware',
    'mozillians.common.middleware.LocaleURLMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'mozillians.common.middleware.HSTSPreloadMiddleware',  # Must be before security middleware
    'mozillians.common.middleware.ReferrerPolicyMiddleware',  # Must be before security middleware
    'django.middleware.security.SecurityMiddleware',

    'session_csrf.CsrfMiddleware',  # Must be after auth middleware.
    # 'mozilla_django_oidc.middleware.SessionRefresh',

    'django.contrib.messages.middleware.MessageMiddleware',

    'csp.middleware.CSPMiddleware',

    'mozillians.common.middleware.StrongholdMiddleware',
    'mozillians.phonebook.middleware.RegisterMiddleware',
    'mozillians.phonebook.middleware.UsernameRedirectionMiddleware',
    'mozillians.groups.middleware.OldGroupRedirectionMiddleware',

    'waffle.middleware.WaffleMiddleware',
]

#############################
# Database configuration
#############################

DATABASES = {
    'default': config('DATABASE_URL', cast=db_url)
}

############################
# Environment variables
############################
DEV = config('DEV', default=False, cast=bool)
DEBUG = config('DEBUG', default=False, cast=bool)

ADMIN_ALIAS = config('ADMIN_ALIAS', default='<EMAIL>')
ADMINS = (('Mozillians.org Admins', ADMIN_ALIAS),)
MANAGERS = ADMINS
DOMAIN = config('DOMAIN', default='mozillians.org')
PROTOCOL = config('PROTOCOL', default='https://')
PORT = config('PORT', default=443, cast=int)
SITE_URL = config('SITE_URL', default='https://mozillians.org')
SECRET_KEY = config('SECRET_KEY', default='')

ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='127.0.0.1', cast=Csv())

# Site ID is used by Django's Sites framework.
SITE_ID = 1

HEALTHCHECKS_IO_URL = config('HEALTHCHECKS_IO_URL', default='')

X_FRAME_OPTIONS = config('X_FRAME_OPTIONS', default='DENY')

# Sessions
SESSION_COOKIE_HTTPONLY = config('SESSION_COOKIE_HTTPONLY', default=True, cast=bool)
SESSION_COOKIE_SECURE = config('SESSION_COOKIE_SECURE', default=True, cast=bool)
SESSION_COOKIE_NAME = config('SESSION_COOKIE_NAME', default='mozillians_sessionid')
ANON_ALWAYS = config('ANON_ALWAYS', default=True, cast=bool)

# Security middleware
SECURE_HSTS_INCLUDE_SUBDOMAINS = config('SECURE_HSTS_INCLUDE_SUBDOMAINS', default=True, cast=bool)
SECURE_HSTS_SECONDS = config('SECURE_HSTS_SECONDS', default=31536000, cast=int)
ENABLE_HSTS_PRELOAD = config('ENABLE_HSTS_PRELOAD', default=True, cast=bool)
SECURE_CONTENT_TYPE_NOSNIFF = config('SECURE_CONTENT_TYPE_NOSNIFF', default=True, cast=bool)
SECURE_BROWSER_XSS_FILTER = config('SECURE_BROWSER_XSS_FILTER', default=True, cast=bool)
ENABLE_REFERRER_HEADER = config('ENABLE_REFERRER_HEADER', default=True, cast=bool)
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# L10n
TIME_ZONE = config('TIME_ZONE', default='America/Los_Angeles')
USE_I18N = config('USE_I18N', default=True, cast=bool)
USE_L10N = config('USE_L10N', default=True, cast=bool)
TEXT_DOMAIN = 'django'
STANDALONE_DOMAINS = [TEXT_DOMAIN, 'djangojs']
LANGUAGE_CODE = config('LANGUAGE_CODE', default='en-US')
LOCALE_PATHS = [Path('locale').resolve()]
# Accepted locales
PROD_LANGUAGES = ('ca', 'cs', 'de', 'en-CA', 'en-US', 'en-GB', 'es', 'hu', 'fr', 'it', 'ko',
                  'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru', 'sk', 'sl', 'sq', 'sr',
                  'sv-SE', 'te', 'zh-TW', 'zh-CN', 'lt', 'ja', 'hsb', 'dsb', 'uk', 'kab',
                  'fy-NL',)
DEV_LANGUAGES = PROD_LANGUAGES
CANONICAL_LOCALES = {
    'en': 'en-US',
}

EXEMPT_L10N_URLS = [
    '^/oidc/authenticate/',
    '^/oidc/callback/',
    '^/verify/identity/',
    '^/verify/identity/callback/',
    '^/api/v1/',
    '^/api/v2/',
    '^/api/v3/',
    '^/admin/',
    '^/beta/.*',
    '^/opensearch.xml',
]

# Tells the extract script what files to parse for strings and what functions to use.

PUENTE = {
    'BASE_DIR': ROOT.parent,
    'DOMAIN_METHODS': {
        'django': [
            ('mozillians/**.py', 'python'),
            ('mozillians/**/templates/**.html', 'django'),
            ('mozillians/**/jinja2/**.html', 'jinja2')<commit_msg>Add bn locale to prod languages.<commit_after># -*- coding: utf-8 -*-

# Django settings for the mozillians project.
import json
import os.path
import sys

from django.utils.functional import lazy

from decouple import config, Csv
from unipath import Path
from dj_database_url import parse as db_url
from django_jinja.builtins import DEFAULT_EXTENSIONS
from urlparse import urljoin

PROJECT_MODULE = 'mozillians'
# Root path of the project
ROOT = Path(__file__).parent
# Defines the views served for root URLs.
ROOT_URLCONF = '%s.urls' % PROJECT_MODULE
# Absolute path to the directory that holds media.
MEDIA_ROOT = Path('media').resolve()
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
MEDIA_URL = config('MEDIA_URL', default='/media/')
# Absolute path to the directory static files should be collected to.
STATIC_ROOT = Path('static').resolve()
# URL prefix for static files served via whitenoise
STATIC_HOST = config('STATIC_HOST', default='')
# URL prefix for static files.
STATIC_URL = STATIC_HOST + '/static/'

# Application definition
########################
INSTALLED_APPS = (
    'dal',
    'dal_select2',

    # Django contrib apps
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.staticfiles',
    'django.contrib.messages',
    'django.contrib.admin',

    # Third-party apps, patches, fixes
    'django_jinja',
    'puente',
    'compressor',
    'cronjobs',
    'django_nose',
    'session_csrf',
    'product_details',
    'csp',
    'mozilla_django_oidc',
    'cities_light',
    'axes',
    'haystack',
    'graphene_django',

    'mozillians',
    'mozillians.users',
    'mozillians.phonebook',
    'mozillians.groups',
    'mozillians.common',
    'mozillians.api',
    'mozillians.mozspaces',
    'mozillians.funfacts',
    'mozillians.announcements',
    'mozillians.humans',
    'mozillians.geo',
    'mozillians.graphql_profiles',
    'mozillians.dino_park',

    'sorl.thumbnail',
    'import_export',
    'waffle',
    'rest_framework',
    'django_filters',
    'raven.contrib.django.raven_compat',
)

MIDDLEWARE = [
    'whitenoise.middleware.WhiteNoiseMiddleware',

    'django.middleware.common.CommonMiddleware',
    'mozillians.common.middleware.LocaleURLMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'mozillians.common.middleware.HSTSPreloadMiddleware',  # Must be before security middleware
    'mozillians.common.middleware.ReferrerPolicyMiddleware',  # Must be before security middleware
    'django.middleware.security.SecurityMiddleware',

    'session_csrf.CsrfMiddleware',  # Must be after auth middleware.
    # 'mozilla_django_oidc.middleware.SessionRefresh',

    'django.contrib.messages.middleware.MessageMiddleware',

    'csp.middleware.CSPMiddleware',

    'mozillians.common.middleware.StrongholdMiddleware',
    'mozillians.phonebook.middleware.RegisterMiddleware',
    'mozillians.phonebook.middleware.UsernameRedirectionMiddleware',
    'mozillians.groups.middleware.OldGroupRedirectionMiddleware',

    'waffle.middleware.WaffleMiddleware',
]

#############################
# Database configuration
#############################

DATABASES = {
    'default': config('DATABASE_URL', cast=db_url)
}

############################
# Environment variables
############################
DEV = config('DEV', default=False, cast=bool)
DEBUG = config('DEBUG', default=False, cast=bool)

ADMIN_ALIAS = config('ADMIN_ALIAS', default='<EMAIL>')
ADMINS = (('Mozillians.org Admins', ADMIN_ALIAS),)
MANAGERS = ADMINS
DOMAIN = config('DOMAIN', default='mozillians.org')
PROTOCOL = config('PROTOCOL', default='https://')
PORT = config('PORT', default=443, cast=int)
SITE_URL = config('SITE_URL', default='https://mozillians.org')
SECRET_KEY = config('SECRET_KEY', default='')

ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='127.0.0.1', cast=Csv())

# Site ID is used by Django's Sites framework.
SITE_ID = 1

HEALTHCHECKS_IO_URL = config('HEALTHCHECKS_IO_URL', default='')

X_FRAME_OPTIONS = config('X_FRAME_OPTIONS', default='DENY')

# Sessions
SESSION_COOKIE_HTTPONLY = config('SESSION_COOKIE_HTTPONLY', default=True, cast=bool)
SESSION_COOKIE_SECURE = config('SESSION_COOKIE_SECURE', default=True, cast=bool)
SESSION_COOKIE_NAME = config('SESSION_COOKIE_NAME', default='mozillians_sessionid')
ANON_ALWAYS = config('ANON_ALWAYS', default=True, cast=bool)

# Security middleware
SECURE_HSTS_INCLUDE_SUBDOMAINS = config('SECURE_HSTS_INCLUDE_SUBDOMAINS', default=True, cast=bool)
SECURE_HSTS_SECONDS = config('SECURE_HSTS_SECONDS', default=31536000, cast=int)
ENABLE_HSTS_PRELOAD = config('ENABLE_HSTS_PRELOAD', default=True, cast=bool)
SECURE_CONTENT_TYPE_NOSNIFF = config('SECURE_CONTENT_TYPE_NOSNIFF', default=True, cast=bool)
SECURE_BROWSER_XSS_FILTER = config('SECURE_BROWSER_XSS_FILTER', default=True, cast=bool)
ENABLE_REFERRER_HEADER = config('ENABLE_REFERRER_HEADER', default=True, cast=bool)
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# L10n
TIME_ZONE = config('TIME_ZONE', default='America/Los_Angeles')
USE_I18N = config('USE_I18N', default=True, cast=bool)
USE_L10N = config('USE_L10N', default=True, cast=bool)
TEXT_DOMAIN = 'django'
STANDALONE_DOMAINS = [TEXT_DOMAIN, 'djangojs']
LANGUAGE_CODE = config('LANGUAGE_CODE', default='en-US')
LOCALE_PATHS = [Path('locale').resolve()]
# Accepted locales
PROD_LANGUAGES = ('bn', 'ca', 'cs', 'de', 'en-CA', 'en-US', 'en-GB', 'es', 'hu', 'fr', 'it', 'ko',
                  'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru', 'sk', 'sl', 'sq', 'sr',
                  'sv-SE', 'te', 'zh-TW', 'zh-CN', 'lt', 'ja', 'hsb', 'dsb', 'uk', 'kab',
                  'fy-NL',)
DEV_LANGUAGES = PROD_LANGUAGES
CANONICAL_LOCALES = {
    'en': 'en-US',
}

EXEMPT_L10N_URLS = [
    '^/oidc/authenticate/',
    '^/oidc/callback/',
    '^/verify/identity/',
    '^/verify/identity/callback/',
    '^/api/v1/',
    '^/api/v2/',
    '^/api/v3/',
    '^/admin/',
    '^/beta/.*',
    '^/opensearch.xml',
]

# Tells the extract script what files to parse for strings and what functions to use.

PUENTE = {
    'BASE_DIR': ROOT.parent,
    'DOMAIN_METHODS': {
        'django': [
            ('mozillians/**.py', 'python'),
            ('mozillians/**/templates/**.html', 'django'),
            ('mozillians/**/jinja2/**.html', 'jinja2')
{'fraction_non_alphanumeric': 0.1630375823324293, 'fraction_numerical': 0.005734211545912437, 'mean_word_length': 4.866363636363636, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 2, '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': '199945', 'n_tokens_mistral': 4572, 'n_tokens_neox': 4417, 'n_words': 821}