# -*- coding: utf-8 -*-
'''
Created on Oct 23, 2012

@author: ymh
'''
import os, logging

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.
    }
}

# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# In a Windows environment this must be set to your system time zone.
TIME_ZONE = 'Europe/Paris'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

BASE_ROOT = os.path.dirname(os.path.abspath(__file__)).rstrip("/")+"/"
BASE_URL = '%(base_url)s'
BASE_STATIC_URL = BASE_URL + 'static/'

# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/media/"
MEDIA_ROOT = os.path.abspath(BASE_ROOT + "../../static/media").rstrip("/")+"/"

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash.
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = BASE_STATIC_URL + "media/"

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = os.path.abspath(BASE_ROOT + "../../static/site").rstrip("/")+"/"

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = BASE_STATIC_URL + "site/"

# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error when DEBUG=False.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOG_FILE = os.path.abspath(os.path.join(BASE_ROOT,"../log/log.txt"))
LOG_LEVEL = logging.DEBUG

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    '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',
            '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,
        },
        'hp': {
            'handlers': ['file'],
            'level': LOG_LEVEL,
            'propagate': True,
        },
    }
}

LDT_NETLOC = "%(ldt_netloc)s"
LDT_DOMAIN = 'http://'+LDT_NETLOC
LDT_BASE_URL = LDT_DOMAIN + '%(ldt_baseurl)s'
LDT_URL = LDT_BASE_URL + '%(ldt_url)s'
LDT_API_URL = LDT_URL + 'api/ldt/1.0/'
LDT_STATIC_URL = LDT_BASE_URL + "static/site/"

PER_PAGE = 9
LDT_MAX_FETCH = 200

KC_URL = 'http://176.32.94.234/kn-concierge/'

