"""
Django settings for windopen_starter project.

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

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

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


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'keuhh=0*%do-ayvy*m2k=vss*$7)j8q!@u0+d^na7mi2(^!l!d'

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

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'windopen',
    'bootstrapform',
    # 'django_openid',
    'django_nose',
    'rest_framework',
    'corsheaders',
    'rpyc_server'
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'corsheaders.middleware.CorsMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    #'django_openid_consumer.SessionConsumer',
)

ROOT_URLCONF = 'windopen_starter.urls'

WSGI_APPLICATION = 'windopen_starter.wsgi.application'


# Database
# https://docs.djangoproject.com/en/1.7/ref/settings/#databases

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'db.sqlite3',
#         'USER': 'root',
#         'PASSWORD': 'mido',
#         'HOST': '127.0.0.1'
    }
}

# Internationalization
# https://docs.djangoproject.com/en/1.7/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/

STATIC_URL = '/static/'

TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]

# Use nose to run all tests
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

# Tell nose to measure coverage on the 'foo' and 'bar' apps
NOSE_ARGS = [
    '--with-coverage',
    '--cover-package=windopen/scripts',
]

CORS_ORIGIN_ALLOW_ALL = True

############
#   KEYS   #
############

GITHUB_CLIENT_ID = 'client_id='
GITHUB_CLIENT_SECRET = 'client_secret='

TUMBLR_CONSUMER_KEY = ''
TUMBLR_CONSUMER_SECRET =''

INSTAGRAM_CLIENT_ID = ''
INSTAGRAM_CLIENT_SECRET = ''

GOOGLEMAP_API_KEY = ''
YAHOO_CONSUMER_KEY = ''
YAHOO_CONSUMER_SECRET = ''
YAHOO_APP_ID = ''

TWITTER_CONSUMER_KEY = ''
TWITTER_CONSUMER_SECRET = ''
TWITTER_ACCESS_TOKEN = ''
TWITTER_ACCESS_TOKEN_SECRET = ''

MEETUP_CONSUMER_KEY = ''
MEETUP_CONSUMER_SECRET = ''

BITBUCKET_CONSUMER_KEY = ''
BITBUCKET_CONSUMER_SECRET = ''

LINKEDIN_CLIENT_ID = ''
LINKEDIN_CLIENT_SECRET = ''

YELP_CONSUMER_KEY = ''
YELP_CONSUMER_SECRET = ''
YELP_TOKEN = ''
YELP_TOKEN_SECRET = ''

POPAPIKEY = ''
TOPAPIKEY = ''

QUANDLAPIKEY = ''

FACEBOOK_APP_ID = ''
FACEBOOK_APP_SECRET = ''

GOOGLE_PLUS_APP_ID = ''
GOOGLE_PLUS_APP_SECRET = ''

DROPBOX_APP_ID = ''
DROPBOX_APP_SECRET = ''

FOURSQUARE_APP_ID = ''
FOURSQUARE_APP_SECRET = ''

RPYC_PORT = 8010
HOSTNAME = '192.168.254.10'
# HOSTNAME = '127.0.0.1'

# RPyc config
R_CONFIG = {
    'allow_pickle': True,
    'allow_getattr': True,
    'allow_setattr': True,
    'allow_delattr': True,
    'allow_all_attrs': True,
    }
SERVER_START = True

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse',
        }
    },
    'formatters': {
        'simple': {
            'format': '%(asctime)s %(levelname)s %(message)s'
        },
        'verbose': {
            'format': '%(asctime)s %(levelname)-8s %(message)s',
            'datefmt': '%y-%m-%d %H:%M:%S',
        },
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler',
            'filters': ['require_debug_false'],
        },
        'debugtoolbar': {
            'level': 'INFO',
            'class': 'logging.StreamHandler'
        },
        'windopen': {
            'level': 'INFO',
            'class': 'logging.FileHandler',
            'formatter': 'verbose',
            'filename': os.path.join(BASE_DIR, 'logs', 'windopen.log')
        },
        'mtu_service': {
            'level': 'INFO',
            'class': 'logging.FileHandler',
            'formatter': 'verbose',
            'filename': os.path.join(BASE_DIR, 'logs', 'mtu_service.log')
        }
    },
    'loggers': {
        'django.request': {
            'handlers': ['mail_admins'],
            'level': 'ERROR',
        },
        'windopen': {
            'handlers': ['windopen'],
            'level': 'DEBUG',
        },
        'mtu_service': {
            'handlers': ['mtu_service'],
            'level': 'DEBUG',
        }
    }
}