<commit_before>"""
Django settings for ControlPanel project.

Generated by 'django-admin startproject' using Django 2.0.4.

For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""

import os
import socket

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
CP2_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # ControlPanel
IPOLDEVEL_DIR = os.path.normpath(os.path.join(CP2_DIR, '../..')) # ipolDevel
HOME_DIR = os.path.normpath(os.path.join(IPOLDEVEL_DIR, '..')) # ipol user folder



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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'ng&u0bv6bm6cs+w+c#=*b0-#g-e_*t(my7(q@&1@^b5m@-)&^!'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

HOST_NAME = os.environ.get('IPOL_HOST', socket.getfqdn())
IPOL_URL = os.environ.get('IPOL_URL', 'http://' + socket.getfqdn())
ALLOWED_HOSTS = []

dev_machines = ['127.0.0.1', 'localhost', 'integration.ipol.im']
production_servers = ['ipolcore.ipol.im']

ALLOWED_HOSTS = [HOST_NAME]

CORS_ALLOWED_ORIGINS = [
    IPOL_URL,
    'localhost',
    '127.0.0.1'
]
CSRF_TRUSTED_ORIGINS = [
    IPOL_URL,
    'http://localhost',
    'http://127.0.0.1'
]

if HOST_NAME in dev_machines:
    ALLOWED_HOSTS = [HOST_NAME, '127.0.0.1', 'localhost']
    DEBUG = True
elif HOST_NAME in production_servers:
    DEBUG = False

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/
# python3 manage.py collectstatic pour copier les fichiers static (du projet et de l'admin) dans 
STATIC_URL = 'cp2/static/'
STATIC_ROOT = os.path.join(HOME_DIR, 'CP2_STATIC')
STATICFILES_DIRS = (
#     # Put strings here, like "/home/html/static" or "C:/www/django/static".
#     # Always use forward slashes, even on Windows.
#     # Don't forget to use absolute paths, not relative paths.
    os.path.join(CP2_DIR, 'static_cp'),
)

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'ControlPanel',
    'gunicorn',
]

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_HOST = HOST_NAME
EMAIL_PORT = 2525
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'IPOL Team <<EMAIL>>'

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',<commit_msg>[cp2] email configuration fixed<commit_after>"""
Django settings for ControlPanel project.

Generated by 'django-admin startproject' using Django 2.0.4.

For more information on this file, see
https://docs.djangoproject.com/en/2.0/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.0/ref/settings/
"""

import os
import socket

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
CP2_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # ControlPanel
IPOLDEVEL_DIR = os.path.normpath(os.path.join(CP2_DIR, '../..')) # ipolDevel
HOME_DIR = os.path.normpath(os.path.join(IPOLDEVEL_DIR, '..')) # ipol user folder



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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '<KEY>

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

HOST_NAME = os.environ.get('IPOL_HOST', socket.getfqdn())
IPOL_URL = os.environ.get('IPOL_URL', 'http://' + socket.getfqdn())
ALLOWED_HOSTS = []

dev_machines = ['127.0.0.1', 'localhost', 'integration.ipol.im']
production_servers = ['ipolcore.ipol.im']

ALLOWED_HOSTS = [HOST_NAME]

CORS_ALLOWED_ORIGINS = [
    IPOL_URL,
    'localhost',
    '127.0.0.1'
]
CSRF_TRUSTED_ORIGINS = [
    IPOL_URL,
    'http://localhost',
    'http://127.0.0.1'
]

if HOST_NAME in dev_machines:
    ALLOWED_HOSTS = [HOST_NAME, '127.0.0.1', 'localhost']
    DEBUG = True
elif HOST_NAME in production_servers:
    DEBUG = False

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/
# python3 manage.py collectstatic pour copier les fichiers static (du projet et de l'admin) dans 
STATIC_URL = 'cp2/static/'
STATIC_ROOT = os.path.join(HOME_DIR, 'CP2_STATIC')
STATICFILES_DIRS = (
#     # Put strings here, like "/home/html/static" or "C:/www/django/static".
#     # Always use forward slashes, even on Windows.
#     # Don't forget to use absolute paths, not relative paths.
    os.path.join(CP2_DIR, 'static_cp'),
)

# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'ControlPanel',
    'gunicorn',
]

EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 25
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = True

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
{'fraction_non_alphanumeric': 0.14109281437125748, 'fraction_numerical': 0.017964071856287425, 'mean_word_length': 4.1994163424124515, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 8, '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': '3420869', 'n_tokens_mistral': 2014, 'n_tokens_neox': 1945, 'n_words': 406}