<commit_before>import json
import os

from django.conf.global_settings import LANGUAGES as GLOBAL_LANGUAGES
from django.core.exceptions import ImproperlyConfigured
import environ

CONFIG_FILE_NAME = "config_dev.env"


root = environ.Path(__file__) - 2  # two levels back in hierarchy
env = environ.Env(
    DEBUG=(bool, False),
    LANGUAGES=(list, ['fi', 'sv', 'en']),
    DATABASE_URL=(str, 'postgis:///servicemap'),
    ELASTICSEARCH_URL=(str, None),
    DISABLE_HAYSTACK_SIGNAL_PROCESSOR=(bool, False),
    ALLOWED_HOSTS=(list, []),
    SENTRY_DSN=(str, ''),  # todo
    SENTRY_ENVIRONMENT=(str, 'development'),  # todo
    COOKIE_PREFIX=(str, 'servicemap'),  # todo
    INTERNAL_IPS=(list, []),  # todo
    MEDIA_ROOT=(environ.Path(), root('media')),
    STATIC_ROOT=(environ.Path(), root('static')),
)

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

# Django environ has a nasty habit of complanining at level
# WARN about env file not being preset. Here we pre-empt it.
env_file_path = os.path.join(BASE_DIR, CONFIG_FILE_NAME)
if os.path.exists(env_file_path):
    # Logging configuration is not available at this point
    print(f'Reading config from {env_file_path}')
    environ.Env.read_env(env_file_path)

DEBUG = env('DEBUG')
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = env('ALLOWED_HOSTS')

# Application definition
INSTALLED_APPS = (
    'polymorphic',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.staticfiles',
    'django.contrib.gis',<commit_msg>Add missing env setting for production deployments<commit_after>import json
import os

from django.conf.global_settings import LANGUAGES as GLOBAL_LANGUAGES
from django.core.exceptions import ImproperlyConfigured
import environ

CONFIG_FILE_NAME = "config_dev.env"


root = environ.Path(__file__) - 2  # two levels back in hierarchy
env = environ.Env(
    DEBUG=(bool, False),
    LANGUAGES=(list, ['fi', 'sv', 'en']),
    DATABASE_URL=(str, 'postgis:///servicemap'),
    ELASTICSEARCH_URL=(str, None),
    DISABLE_HAYSTACK_SIGNAL_PROCESSOR=(bool, False),
    ALLOWED_HOSTS=(list, []),
    SENTRY_DSN=(str, ''),  # todo
    SENTRY_ENVIRONMENT=(str, 'development'),  # todo
    COOKIE_PREFIX=(str, 'servicemap'),  # todo
    INTERNAL_IPS=(list, []),  # todo
    MEDIA_ROOT=(environ.Path(), root('media')),
    STATIC_ROOT=(environ.Path(), root('static')),
    SECURE_PROXY_SSL_HEADER=(tuple, None),
)

SECURE_PROXY_SSL_HEADER = env('SECURE_PROXY_SSL_HEADER')

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

# Django environ has a nasty habit of complanining at level
# WARN about env file not being preset. Here we pre-empt it.
env_file_path = os.path.join(BASE_DIR, CONFIG_FILE_NAME)
if os.path.exists(env_file_path):
    # Logging configuration is not available at this point
    print(f'Reading config from {env_file_path}')
    environ.Env.read_env(env_file_path)

DEBUG = env('DEBUG')
TEMPLATE_DEBUG = False
ALLOWED_HOSTS = env('ALLOWED_HOSTS')

# Application definition
INSTALLED_APPS = (
    'polymorphic',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.staticfiles',
    'django.contrib.gis',
{'fraction_non_alphanumeric': 0.12865133623368552, 'fraction_numerical': 0.0006215040397762585, 'mean_word_length': 4.758497316636851, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '76934', 'n_tokens_mistral': 1128, 'n_tokens_neox': 1112, 'n_words': 245}