# -*- coding: utf-8 -*-
from . import *
import os, logging

#TODO override
DEBUG = True
TEMPLATE_DEBUG = DEBUG


BASE_URL = '%(base_url)s'
WEB_URL = '%(web_url)s'

PLATFORM_BASE_URL = WEB_URL + BASE_URL + 'ammico/'

STREAM_SRC_PREFIX = ""

BASE_STATIC_URL = WEB_URL + BASE_URL + 'static/'
BASE_STATIC_ROOT = os.path.abspath(BASE_DIR + "../../web/static/").rstrip("/")+"/"


# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = BASE_STATIC_ROOT + "media/"

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = BASE_STATIC_URL + 'media/'


STATIC_URL = BASE_STATIC_URL + 'site/'

# Absolute path to the directory that static files (js, css, swf...)
# DO NOT forget to do command line ./manage.py collectstatic to gather static media into the web/static folder
STATIC_ROOT = BASE_STATIC_ROOT + "site/"


SRC_BASE_URL = BASE_URL + __name__.split('.')[0] + '/'


# Make this unique, and don't share it with anybody.
SECRET_KEY = '%(secret_key)s'

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.%(db_engine)s', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '%(db_name)s',                      # Or path to database file if using sqlite3.
        'USER': '%(db_user)s',                      # Not used with sqlite3.
        'PASSWORD': '%(db_password)s',                  # Not used with sqlite3.
        'HOST': '%(db_host)s',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '%(db_port)d',                      # Set to empty string for default. Not used with sqlite3.
    },
}

LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../run/log/log.txt"))
LOG_LEVEL = logging.DEBUG

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'formatters' : {
        'simple' : {
            'format': "%(asctime)s - %(levelname)s : %(message)s",
        },
        'semi-verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(message)s'
        },
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        },
        'stream_to_console': {
            'level': LOG_LEVEL,
            'class': 'logging.StreamHandler'
        },
        'file': {
            'level': LOG_LEVEL,
            'class': 'logging.FileHandler',
            'filename': LOG_FILE,
            'formatter': 'semi-verbose',
        },
    },
    'loggers': {
#        'django.db.backends':{
#            'handlers': ['file'],
#            'level': LOG_LEVEL,
#            'propagate': True,
#        },
        'django.request': {
            'handlers': ['file'],
            'level': LOG_LEVEL,
            'propagate': True,
        },
        'ammico': {
            'handlers': ['file'],
            'level': LOG_LEVEL,
            'propagate': True,
        },
    }
}


ADMINS = (
    #('Your Name', 'your_email@domain.com'),
)

MANAGERS = ADMINS

AUTH_JAMESPOT = ''

URL_JAMESPOT = ''
URL_EXALEAD = ''
URL_ORPHEO = ''
