"""
Django settings for roxy-the-renovator project.

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

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

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

import dj_database_url
from email.utils import formataddr
import os
from photologue import PHOTOLOGUE_APP_DIR

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.dirname(PROJECT_DIR)
HOME_DIR = os.path.expanduser("~")


ADMINS = (
    (os.environ.get('ADMIN_NAME', 'admin'), os.environ.get('ADMIN_EMAIL', 'example@example.com')),
)


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY',
                            '06ku851z#uqpzx^@l_vsm=c7!o9*7&i&0556l9_edpm_!d^eia')

DEBUG = bool(int(os.environ.get('DJANGO_DEBUG', False)))

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
ALLOWED_HOSTS = [
    'www.roxy-the-renovator.ca',
    'roxy-the-renovator.ca',
    'roxy-the-renovator.herokuapp.com'
]


# Application definition

INSTALLED_APPS = [
    'home',
    'search',

    'wagtail.wagtailforms',
    'wagtail.wagtailredirects',
    'wagtail.wagtailembeds',
    'wagtail.wagtailsites',
    'wagtail.wagtailusers',
    'wagtail.wagtailsnippets',
    'wagtail.wagtaildocs',
    'wagtail.wagtailimages',
    'wagtail.wagtailsearch',
    'wagtail.wagtailadmin',
    'wagtail.wagtailcore',

    'modelcluster',
    'compressor',
    'taggit',

    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',

    'storages',
    'photologue',
    'sortedm2m',

    'libs',
    'roxy_photologue'
]

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    '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.middleware.security.SecurityMiddleware',

    'wagtail.wagtailcore.middleware.SiteMiddleware',
    'wagtail.wagtailredirects.middleware.RedirectMiddleware',
)

ROOT_URLCONF = 'roxy_the_renovator.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os.path.join(PROJECT_DIR, 'templates'),
            os.path.join(PROJECT_DIR, os.pardir, 'roxy_photologue', 'templates'),
            PHOTOLOGUE_APP_DIR,
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
            'debug': DEBUG,
        },
    },
]

WSGI_APPLICATION = 'roxy_the_renovator.wsgi.application'


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

# Parse database configuration from $DATABASE_URL
DATABASES = {
    'default': dj_database_url.config(default="sqlite:///%s/roxy-the-renovator.sqlite" % HOME_DIR)
}


SITE_ID = 1

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

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'compressor.finders.CompressorFinder',
)

STATICFILES_DIRS = (
    os.path.join(PROJECT_DIR, 'static'),
    os.path.join(BASE_DIR, 'bower_components'),
)

STATIC_ROOT = os.path.join(HOME_DIR, 'roxytherenovator', 'static')
STATIC_URL = '/static/'

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

COMPRESS_OFFLINE = True
COMPRESS_CSS_FILTERS = [
    'compressor.filters.css_default.CssAbsoluteFilter',
    'compressor.filters.cssmin.CSSMinFilter',
]
COMPRESS_CSS_HASHING_METHOD = 'content'


AWS_STORAGE_BUCKET_NAME = 'roxytherenovator'
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')

# If AWS settings are available, use AWS for static and media
if AWS_SECRET_ACCESS_KEY:
    AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME

    STATICFILES_LOCATION = 'static'
    STATICFILES_STORAGE = 'libs.custom_storages.CachedS3BotoStorage'
    STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION)

    MEDIAFILES_LOCATION = 'media'
    DEFAULT_FILE_STORAGE = 'libs.custom_storages.MediaStorage'
    MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)

    COMPRESS_STORAGE = STATICFILES_STORAGE
else:
    MEDIA_ROOT = os.path.join(HOME_DIR, 'roxytherenovator', 'media')
    MEDIA_URL = '/media/'

# Wagtail settings

WAGTAIL_SITE_NAME = "roxy_the_renovator"


# If Heroku addons start using EMAIL_URL, switch to dj-email-url
DEFAULT_FROM_EMAIL = formataddr(ADMINS[0])
EMAIL_HOST = os.environ.get('MAILGUN_SMTP_SERVER')
EMAIL_PORT = os.environ.get('MAILGUN_SMTP_PORT')
EMAIL_HOST_USER = os.environ.get('MAILGUN_SMTP_LOGIN')
EMAIL_HOST_PASSWORD = os.environ.get('MAILGUN_SMTP_PASSWORD')
EMAIL_USE_TLS = True

if not EMAIL_HOST:
    EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
    EMAIL_FILE_PATH = '%s/Development/django_emails/roxy-the-renovator/emails' % HOME_DIR


SLIDE_SHOW_SLUG = '200-slideshow-photos-website'
STARTS_WITH_NUMBER_REGEX = r'^\d.*'

7a254328bdb5711b62aa4eb3bf5402e812442b20
<mask token>

<mask token>
if AWS_SECRET_ACCESS_KEY:
    AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
    STATICFILES_LOCATION = 'static'
    STATICFILES_STORAGE = 'libs.custom_storages.CachedS3BotoStorage'
    STATIC_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION
        )
    MEDIAFILES_LOCATION = 'media'
    DEFAULT_FILE_STORAGE = 'libs.custom_storages.MediaStorage'
    MEDIA_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)
    COMPRESS_STORAGE = STATICFILES_STORAGE
else:
    MEDIA_ROOT = os.path.join(HOME_DIR, 'roxytherenovator', 'media')
    MEDIA_URL = '/media/'
<mask token>
if not EMAIL_HOST:
    EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
    EMAIL_FILE_PATH = (
        '%s/Development/django_emails/roxy-the-renovator/emails' % HOME_DIR)
<mask token>

<mask token>
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.dirname(PROJECT_DIR)
HOME_DIR = os.path.expanduser('~')
ADMINS = (os.environ.get('ADMIN_NAME', 'admin'), os.environ.get(
    'ADMIN_EMAIL', 'example@example.com')),
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY',
    '06ku851z#uqpzx^@l_vsm=c7!o9*7&i&0556l9_edpm_!d^eia')
DEBUG = bool(int(os.environ.get('DJANGO_DEBUG', False)))
SECURE_PROXY_SSL_HEADER = 'HTTP_X_FORWARDED_PROTO', 'https'
ALLOWED_HOSTS = ['www.roxy-the-renovator.ca', 'roxy-the-renovator.ca',
    'roxy-the-renovator.herokuapp.com']
INSTALLED_APPS = ['home', 'search', 'wagtail.wagtailforms',
    'wagtail.wagtailredirects', 'wagtail.wagtailembeds',
    'wagtail.wagtailsites', 'wagtail.wagtailusers',
    'wagtail.wagtailsnippets', 'wagtail.wagtaildocs',
    'wagtail.wagtailimages', 'wagtail.wagtailsearch',
    'wagtail.wagtailadmin', 'wagtail.wagtailcore', 'modelcluster',
    'compressor', 'taggit', 'django.contrib.admin', 'django.contrib.auth',
    'django.contrib.contenttypes', 'django.contrib.sessions',
    'django.contrib.messages', 'django.contrib.staticfiles',
    'django.contrib.sites', 'storages', 'photologue', 'sortedm2m', 'libs',
    'roxy_photologue']
MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    '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.middleware.security.SecurityMiddleware',
    'wagtail.wagtailcore.middleware.SiteMiddleware',
    'wagtail.wagtailredirects.middleware.RedirectMiddleware')
ROOT_URLCONF = 'roxy_the_renovator.urls'
TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [os.path.join(PROJECT_DIR, 'templates'), os.path.join(
    PROJECT_DIR, os.pardir, 'roxy_photologue', 'templates'),
    PHOTOLOGUE_APP_DIR], 'APP_DIRS': True, 'OPTIONS': {'context_processors':
    ['django.template.context_processors.debug',
    'django.template.context_processors.request',
    'django.contrib.auth.context_processors.auth',
    'django.contrib.messages.context_processors.messages'], 'debug': DEBUG}}]
WSGI_APPLICATION = 'roxy_the_renovator.wsgi.application'
DATABASES = {'default': dj_database_url.config(default=
    'sqlite:///%s/roxy-the-renovator.sqlite' % HOME_DIR)}
SITE_ID = 1
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'compressor.finders.CompressorFinder')
STATICFILES_DIRS = os.path.join(PROJECT_DIR, 'static'), os.path.join(BASE_DIR,
    'bower_components')
STATIC_ROOT = os.path.join(HOME_DIR, 'roxytherenovator', 'static')
STATIC_URL = '/static/'
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
COMPRESS_OFFLINE = True
COMPRESS_CSS_FILTERS = ['compressor.filters.css_default.CssAbsoluteFilter',
    'compressor.filters.cssmin.CSSMinFilter']
COMPRESS_CSS_HASHING_METHOD = 'content'
AWS_STORAGE_BUCKET_NAME = 'roxytherenovator'
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
if AWS_SECRET_ACCESS_KEY:
    AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
    STATICFILES_LOCATION = 'static'
    STATICFILES_STORAGE = 'libs.custom_storages.CachedS3BotoStorage'
    STATIC_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION
        )
    MEDIAFILES_LOCATION = 'media'
    DEFAULT_FILE_STORAGE = 'libs.custom_storages.MediaStorage'
    MEDIA_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)
    COMPRESS_STORAGE = STATICFILES_STORAGE
else:
    MEDIA_ROOT = os.path.join(HOME_DIR, 'roxytherenovator', 'media')
    MEDIA_URL = '/media/'
WAGTAIL_SITE_NAME = 'roxy_the_renovator'
DEFAULT_FROM_EMAIL = formataddr(ADMINS[0])
EMAIL_HOST = os.environ.get('MAILGUN_SMTP_SERVER')
EMAIL_PORT = os.environ.get('MAILGUN_SMTP_PORT')
EMAIL_HOST_USER = os.environ.get('MAILGUN_SMTP_LOGIN')
EMAIL_HOST_PASSWORD = os.environ.get('MAILGUN_SMTP_PASSWORD')
EMAIL_USE_TLS = True
if not EMAIL_HOST:
    EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
    EMAIL_FILE_PATH = (
        '%s/Development/django_emails/roxy-the-renovator/emails' % HOME_DIR)
SLIDE_SHOW_SLUG = '200-slideshow-photos-website'
STARTS_WITH_NUMBER_REGEX = '^\\d.*'

<mask token>
import dj_database_url
from email.utils import formataddr
import os
from photologue import PHOTOLOGUE_APP_DIR
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.dirname(PROJECT_DIR)
HOME_DIR = os.path.expanduser('~')
ADMINS = (os.environ.get('ADMIN_NAME', 'admin'), os.environ.get(
    'ADMIN_EMAIL', 'example@example.com')),
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY',
    '06ku851z#uqpzx^@l_vsm=c7!o9*7&i&0556l9_edpm_!d^eia')
DEBUG = bool(int(os.environ.get('DJANGO_DEBUG', False)))
SECURE_PROXY_SSL_HEADER = 'HTTP_X_FORWARDED_PROTO', 'https'
ALLOWED_HOSTS = ['www.roxy-the-renovator.ca', 'roxy-the-renovator.ca',
    'roxy-the-renovator.herokuapp.com']
INSTALLED_APPS = ['home', 'search', 'wagtail.wagtailforms',
    'wagtail.wagtailredirects', 'wagtail.wagtailembeds',
    'wagtail.wagtailsites', 'wagtail.wagtailusers',
    'wagtail.wagtailsnippets', 'wagtail.wagtaildocs',
    'wagtail.wagtailimages', 'wagtail.wagtailsearch',
    'wagtail.wagtailadmin', 'wagtail.wagtailcore', 'modelcluster',
    'compressor', 'taggit', 'django.contrib.admin', 'django.contrib.auth',
    'django.contrib.contenttypes', 'django.contrib.sessions',
    'django.contrib.messages', 'django.contrib.staticfiles',
    'django.contrib.sites', 'storages', 'photologue', 'sortedm2m', 'libs',
    'roxy_photologue']
MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    '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.middleware.security.SecurityMiddleware',
    'wagtail.wagtailcore.middleware.SiteMiddleware',
    'wagtail.wagtailredirects.middleware.RedirectMiddleware')
ROOT_URLCONF = 'roxy_the_renovator.urls'
TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [os.path.join(PROJECT_DIR, 'templates'), os.path.join(
    PROJECT_DIR, os.pardir, 'roxy_photologue', 'templates'),
    PHOTOLOGUE_APP_DIR], 'APP_DIRS': True, 'OPTIONS': {'context_processors':
    ['django.template.context_processors.debug',
    'django.template.context_processors.request',
    'django.contrib.auth.context_processors.auth',
    'django.contrib.messages.context_processors.messages'], 'debug': DEBUG}}]
WSGI_APPLICATION = 'roxy_the_renovator.wsgi.application'
DATABASES = {'default': dj_database_url.config(default=
    'sqlite:///%s/roxy-the-renovator.sqlite' % HOME_DIR)}
SITE_ID = 1
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'compressor.finders.CompressorFinder')
STATICFILES_DIRS = os.path.join(PROJECT_DIR, 'static'), os.path.join(BASE_DIR,
    'bower_components')
STATIC_ROOT = os.path.join(HOME_DIR, 'roxytherenovator', 'static')
STATIC_URL = '/static/'
STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'
COMPRESS_OFFLINE = True
COMPRESS_CSS_FILTERS = ['compressor.filters.css_default.CssAbsoluteFilter',
    'compressor.filters.cssmin.CSSMinFilter']
COMPRESS_CSS_HASHING_METHOD = 'content'
AWS_STORAGE_BUCKET_NAME = 'roxytherenovator'
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
if AWS_SECRET_ACCESS_KEY:
    AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME
    STATICFILES_LOCATION = 'static'
    STATICFILES_STORAGE = 'libs.custom_storages.CachedS3BotoStorage'
    STATIC_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION
        )
    MEDIAFILES_LOCATION = 'media'
    DEFAULT_FILE_STORAGE = 'libs.custom_storages.MediaStorage'
    MEDIA_URL = 'https://%s/%s/' % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)
    COMPRESS_STORAGE = STATICFILES_STORAGE
else:
    MEDIA_ROOT = os.path.join(HOME_DIR, 'roxytherenovator', 'media')
    MEDIA_URL = '/media/'
WAGTAIL_SITE_NAME = 'roxy_the_renovator'
DEFAULT_FROM_EMAIL = formataddr(ADMINS[0])
EMAIL_HOST = os.environ.get('MAILGUN_SMTP_SERVER')
EMAIL_PORT = os.environ.get('MAILGUN_SMTP_PORT')
EMAIL_HOST_USER = os.environ.get('MAILGUN_SMTP_LOGIN')
EMAIL_HOST_PASSWORD = os.environ.get('MAILGUN_SMTP_PASSWORD')
EMAIL_USE_TLS = True
if not EMAIL_HOST:
    EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
    EMAIL_FILE_PATH = (
        '%s/Development/django_emails/roxy-the-renovator/emails' % HOME_DIR)
SLIDE_SHOW_SLUG = '200-slideshow-photos-website'
STARTS_WITH_NUMBER_REGEX = '^\\d.*'

"""
Django settings for roxy-the-renovator project.

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

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

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

import dj_database_url
from email.utils import formataddr
import os
from photologue import PHOTOLOGUE_APP_DIR

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.dirname(PROJECT_DIR)
HOME_DIR = os.path.expanduser("~")


ADMINS = (
    (os.environ.get('ADMIN_NAME', 'admin'), os.environ.get('ADMIN_EMAIL', 'example@example.com')),
)


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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY',
                            '06ku851z#uqpzx^@l_vsm=c7!o9*7&i&0556l9_edpm_!d^eia')

DEBUG = bool(int(os.environ.get('DJANGO_DEBUG', False)))

SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
ALLOWED_HOSTS = [
    'www.roxy-the-renovator.ca',
    'roxy-the-renovator.ca',
    'roxy-the-renovator.herokuapp.com'
]


# Application definition

INSTALLED_APPS = [
    'home',
    'search',

    'wagtail.wagtailforms',
    'wagtail.wagtailredirects',
    'wagtail.wagtailembeds',
    'wagtail.wagtailsites',
    'wagtail.wagtailusers',
    'wagtail.wagtailsnippets',
    'wagtail.wagtaildocs',
    'wagtail.wagtailimages',
    'wagtail.wagtailsearch',
    'wagtail.wagtailadmin',
    'wagtail.wagtailcore',

    'modelcluster',
    'compressor',
    'taggit',

    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',

    'storages',
    'photologue',
    'sortedm2m',

    'libs',
    'roxy_photologue'
]

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware',
    '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.middleware.security.SecurityMiddleware',

    'wagtail.wagtailcore.middleware.SiteMiddleware',
    'wagtail.wagtailredirects.middleware.RedirectMiddleware',
)

ROOT_URLCONF = 'roxy_the_renovator.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [
            os.path.join(PROJECT_DIR, 'templates'),
            os.path.join(PROJECT_DIR, os.pardir, 'roxy_photologue', 'templates'),
            PHOTOLOGUE_APP_DIR,
        ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
            'debug': DEBUG,
        },
    },
]

WSGI_APPLICATION = 'roxy_the_renovator.wsgi.application'


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

# Parse database configuration from $DATABASE_URL
DATABASES = {
    'default': dj_database_url.config(default="sqlite:///%s/roxy-the-renovator.sqlite" % HOME_DIR)
}


SITE_ID = 1

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

STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder',
    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    'compressor.finders.CompressorFinder',
)

STATICFILES_DIRS = (
    os.path.join(PROJECT_DIR, 'static'),
    os.path.join(BASE_DIR, 'bower_components'),
)

STATIC_ROOT = os.path.join(HOME_DIR, 'roxytherenovator', 'static')
STATIC_URL = '/static/'

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

COMPRESS_OFFLINE = True
COMPRESS_CSS_FILTERS = [
    'compressor.filters.css_default.CssAbsoluteFilter',
    'compressor.filters.cssmin.CSSMinFilter',
]
COMPRESS_CSS_HASHING_METHOD = 'content'


AWS_STORAGE_BUCKET_NAME = 'roxytherenovator'
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')

# If AWS settings are available, use AWS for static and media
if AWS_SECRET_ACCESS_KEY:
    AWS_S3_CUSTOM_DOMAIN = '%s.s3.amazonaws.com' % AWS_STORAGE_BUCKET_NAME

    STATICFILES_LOCATION = 'static'
    STATICFILES_STORAGE = 'libs.custom_storages.CachedS3BotoStorage'
    STATIC_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, STATICFILES_LOCATION)

    MEDIAFILES_LOCATION = 'media'
    DEFAULT_FILE_STORAGE = 'libs.custom_storages.MediaStorage'
    MEDIA_URL = "https://%s/%s/" % (AWS_S3_CUSTOM_DOMAIN, MEDIAFILES_LOCATION)

    COMPRESS_STORAGE = STATICFILES_STORAGE
else:
    MEDIA_ROOT = os.path.join(HOME_DIR, 'roxytherenovator', 'media')
    MEDIA_URL = '/media/'

# Wagtail settings

WAGTAIL_SITE_NAME = "roxy_the_renovator"


# If Heroku addons start using EMAIL_URL, switch to dj-email-url
DEFAULT_FROM_EMAIL = formataddr(ADMINS[0])
EMAIL_HOST = os.environ.get('MAILGUN_SMTP_SERVER')
EMAIL_PORT = os.environ.get('MAILGUN_SMTP_PORT')
EMAIL_HOST_USER = os.environ.get('MAILGUN_SMTP_LOGIN')
EMAIL_HOST_PASSWORD = os.environ.get('MAILGUN_SMTP_PASSWORD')
EMAIL_USE_TLS = True

if not EMAIL_HOST:
    EMAIL_BACKEND = 'django.core.mail.backends.filebased.EmailBackend'
    EMAIL_FILE_PATH = '%s/Development/django_emails/roxy-the-renovator/emails' % HOME_DIR


SLIDE_SHOW_SLUG = '200-slideshow-photos-website'
STARTS_WITH_NUMBER_REGEX = r'^\d.*'
