"""
Django settings for tracktool project.

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

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

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from django.conf import global_settings

BASE_DIR = os.path.dirname(os.path.dirname(__file__))


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ['SECRET_KEY']

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

TEMPLATE_DEBUG = True

ALLOWED_HOSTS = []


# User model
AUTH_USER_MODEL = 'users.TrackUser'


# Application definition

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.humanize',
    'django_extensions',
    'clients',
    'contracts',
    'notifications',
    'photoshoots',
    'products',
    'projects',
    'project_settings',
    'users',
    'sekizai',
    'south',
    'timezone_field',
    'tastypie',
    'djangobower',
)

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
)

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.contrib.auth.context_processors.auth',
    'django.core.context_processors.request',
    'django.core.context_processors.debug',
    'django.core.context_processors.i18n',
    'django.core.context_processors.media',
    'django.core.context_processors.static',
    'django.core.context_processors.tz',
    'django.contrib.messages.context_processors.messages',
    'sekizai.context_processors.sekizai',
)

ROOT_URLCONF = 'tracktool.urls'

WSGI_APPLICATION = 'tracktool.wsgi.application'


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

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': 'jghyllebert',
        'USER': 'jghyllebert',
        'PASSWORD': os.environ['DATABASE_PASSWORD'],
    }
}

# Internationalization
# https://docs.djangoproject.com/en/1.6/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.6/howto/static-files/

STATIC_URL = '/static/'

TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, "templates"),
)

STATICFILES_FINDERS = global_settings.STATICFILES_FINDERS + (
    'djangobower.finders.BowerFinder',
)

LOGIN_URL = 'user_login'
LOGOUT_URL = 'user_logout'

GOOGLE_CLIENT = os.environ['GOOGLE_CLIENT']
GOOGLE_SECRET = os.environ['GOOGLE_SECRET']
OAUTH_SCOPE = [
    'https://www.googleapis.com/auth/drive.file',
    'https://www.googleapis.com/auth/userinfo.email',
    'https://www.googleapis.com/auth/userinfo.profile',
    # Add other requested scopes.
]

REDIRECT_URL = "http://127.0.0.1:8000/get_my_stuff/"
DRIVE_PARENT_FOLDER_ID = os.environ['DRIVE_PARENT_FOLDER']

#The user that is connected to Google, most of the time this will be the superuser you created when performing syncdb
#the first time. Change if otherwise
USER_ID_GOOGLE_OAUTH = 1

#Product flow placeholder
#If a product has options, they will be added where the placeholder is in the flow
FLOW_OPTIONS_PLACEHOLDER = "-- INSERT OPTIONS --"


### Bower settings ###

BOWER_COMPONENTS_ROOT = os.path.join(BASE_DIR, "bower_components")

# run ./manage.py bower install
# https://github.com/thedrow/django-bower
BOWER_INSTALLED_APPS = (
    'underscore',
    'backbone',
    'datetimepicker',
)