import os
from .common import *

try:
    # Python 2.x
    import urlparse
except ImportError:
    # Python 3.x
    from urllib import parse as urlparse

# Honor the 'X-Forwarded-Proto' header for request.is_secure()
# https://devcenter.heroku.com/articles/getting-started-with-django
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# django-secure
# http://django-secure.readthedocs.org/en/v0.1.2/settings.html
INSTALLED_APPS += ("djangosecure",)

SECURE_HSTS_SECONDS = 0
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_FRAME_DENY = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
SESSION_COOKIE_SECURE = False
SESSION_COOKIE_HTTPONLY = True
SECURE_SSL_REDIRECT = False

# Site
# https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ["*"]

INSTALLED_APPS += ("gunicorn",)

# Template
# https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
TEMPLATE_LOADERS = (
    ('django.template.loaders.cached.Loader', (
        'django.template.loaders.filesystem.Loader',
        'django.template.loaders.app_directories.Loader',
    )),
)

# Media files
# http://django-storages.readthedocs.org/en/latest/index.html
# INSTALLED_APPS += ('storages',)
# DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
# AWS_ACCESS_KEY_ID = values.Value('DJANGO_AWS_ACCESS_KEY_ID')
# AWS_SECRET_ACCESS_KEY = values.Value('DJANGO_AWS_SECRET_ACCESS_KEY')
# AWS_STORAGE_BUCKET_NAME = values.Value('DJANGO_AWS_STORAGE_BUCKET_NAME')
# AWS_DEFAULT_ACL = values.Value('public-read')
# AWS_AUTO_CREATE_BUCKET = True
# AWS_QUERYSTRING_AUTH = False
# MEDIA_URL = 'https://s3.amazonaws.com/{}/'.format(AWS_STORAGE_BUCKET_NAME)
# AWS_S3_CALLING_FORMAT = OrdinaryCallingFormat()

# https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching#cache-control
# Response can be cached by browser and any intermediary caches (i.e. it is "public") for up to 1 day
# 86400 = (60 seconds x 60 minutes x 24 hours)
# AWS_HEADERS = {
#     'Cache-Control': 'max-age=86400, s-maxage=86400, must-revalidate',
# }

# Static files
# STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

# Caching
redis_url = urlparse.urlparse(os.environ.get('REDISTOGO_URL', 'redis://localhost:6379'))
CACHES = {
    'default': {
        'BACKEND': 'redis_cache.RedisCache',
        'LOCATION': '{}:{}'.format(redis_url.hostname, redis_url.port),
        'OPTIONS': {
            'DB': 0,
            'PASSWORD': redis_url.password,
            'PARSER_CLASS': 'redis.connection.HiredisParser',
            'CONNECTION_POOL_CLASS': 'redis.BlockingConnectionPool',
            'CONNECTION_POOL_CLASS_KWARGS': {
                'max_connections': 50,
                'timeout': 20,
            }
        }
    }
}

# Django RQ production settings
RQ_QUEUES = {
    'default': {
        'URL': os.getenv('REDISTOGO_URL', 'redis://localhost:6379'),
        'DB': 0,
        'DEFAULT_TIMEOUT': 500,
    },
}

VERSATILEIMAGEFIELD_SETTINGS['create_images_on_demand'] = False

# 阿里云
DEFAULT_FILE_STORAGE = 'aliyun_oss2_storage.backends.AliyunMediaStorage'
BUCKET_NAME = "hxt-{{cookiecutter.app_name}}-prd"
a36e7295df406354d8c330d9f18860072ba25d30
<mask token>

<mask token>
try:
    import urlparse
except ImportError:
    from urllib import parse as urlparse
INSTALLED_APPS += 'djangosecure',
<mask token>
INSTALLED_APPS += 'gunicorn',
<mask token>

<mask token>
try:
    import urlparse
except ImportError:
    from urllib import parse as urlparse
INSTALLED_APPS += 'djangosecure',
SECURE_HSTS_SECONDS = 0
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_FRAME_DENY = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
SESSION_COOKIE_SECURE = False
SESSION_COOKIE_HTTPONLY = True
SECURE_SSL_REDIRECT = False
ALLOWED_HOSTS = ['*']
INSTALLED_APPS += 'gunicorn',
TEMPLATE_LOADERS = ('django.template.loaders.cached.Loader', (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader')),
redis_url = urlparse.urlparse(os.environ.get('REDISTOGO_URL',
    'redis://localhost:6379'))
CACHES = {'default': {'BACKEND': 'redis_cache.RedisCache', 'LOCATION':
    '{}:{}'.format(redis_url.hostname, redis_url.port), 'OPTIONS': {'DB': 0,
    'PASSWORD': redis_url.password, 'PARSER_CLASS':
    'redis.connection.HiredisParser', 'CONNECTION_POOL_CLASS':
    'redis.BlockingConnectionPool', 'CONNECTION_POOL_CLASS_KWARGS': {
    'max_connections': 50, 'timeout': 20}}}}
RQ_QUEUES = {'default': {'URL': os.getenv('REDISTOGO_URL',
    'redis://localhost:6379'), 'DB': 0, 'DEFAULT_TIMEOUT': 500}}
VERSATILEIMAGEFIELD_SETTINGS['create_images_on_demand'] = False
DEFAULT_FILE_STORAGE = 'aliyun_oss2_storage.backends.AliyunMediaStorage'
BUCKET_NAME = 'hxt-{{cookiecutter.app_name}}-prd'

import os
from .common import *
try:
    import urlparse
except ImportError:
    from urllib import parse as urlparse
INSTALLED_APPS += 'djangosecure',
SECURE_HSTS_SECONDS = 0
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_FRAME_DENY = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
SESSION_COOKIE_SECURE = False
SESSION_COOKIE_HTTPONLY = True
SECURE_SSL_REDIRECT = False
ALLOWED_HOSTS = ['*']
INSTALLED_APPS += 'gunicorn',
TEMPLATE_LOADERS = ('django.template.loaders.cached.Loader', (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader')),
redis_url = urlparse.urlparse(os.environ.get('REDISTOGO_URL',
    'redis://localhost:6379'))
CACHES = {'default': {'BACKEND': 'redis_cache.RedisCache', 'LOCATION':
    '{}:{}'.format(redis_url.hostname, redis_url.port), 'OPTIONS': {'DB': 0,
    'PASSWORD': redis_url.password, 'PARSER_CLASS':
    'redis.connection.HiredisParser', 'CONNECTION_POOL_CLASS':
    'redis.BlockingConnectionPool', 'CONNECTION_POOL_CLASS_KWARGS': {
    'max_connections': 50, 'timeout': 20}}}}
RQ_QUEUES = {'default': {'URL': os.getenv('REDISTOGO_URL',
    'redis://localhost:6379'), 'DB': 0, 'DEFAULT_TIMEOUT': 500}}
VERSATILEIMAGEFIELD_SETTINGS['create_images_on_demand'] = False
DEFAULT_FILE_STORAGE = 'aliyun_oss2_storage.backends.AliyunMediaStorage'
BUCKET_NAME = 'hxt-{{cookiecutter.app_name}}-prd'

import os
from .common import *

try:
    # Python 2.x
    import urlparse
except ImportError:
    # Python 3.x
    from urllib import parse as urlparse

# Honor the 'X-Forwarded-Proto' header for request.is_secure()
# https://devcenter.heroku.com/articles/getting-started-with-django
# SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')

# django-secure
# http://django-secure.readthedocs.org/en/v0.1.2/settings.html
INSTALLED_APPS += ("djangosecure",)

SECURE_HSTS_SECONDS = 0
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_FRAME_DENY = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_BROWSER_XSS_FILTER = True
SESSION_COOKIE_SECURE = False
SESSION_COOKIE_HTTPONLY = True
SECURE_SSL_REDIRECT = False

# Site
# https://docs.djangoproject.com/en/1.6/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ["*"]

INSTALLED_APPS += ("gunicorn",)

# Template
# https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
TEMPLATE_LOADERS = (
    ('django.template.loaders.cached.Loader', (
        'django.template.loaders.filesystem.Loader',
        'django.template.loaders.app_directories.Loader',
    )),
)

# Media files
# http://django-storages.readthedocs.org/en/latest/index.html
# INSTALLED_APPS += ('storages',)
# DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
# AWS_ACCESS_KEY_ID = values.Value('DJANGO_AWS_ACCESS_KEY_ID')
# AWS_SECRET_ACCESS_KEY = values.Value('DJANGO_AWS_SECRET_ACCESS_KEY')
# AWS_STORAGE_BUCKET_NAME = values.Value('DJANGO_AWS_STORAGE_BUCKET_NAME')
# AWS_DEFAULT_ACL = values.Value('public-read')
# AWS_AUTO_CREATE_BUCKET = True
# AWS_QUERYSTRING_AUTH = False
# MEDIA_URL = 'https://s3.amazonaws.com/{}/'.format(AWS_STORAGE_BUCKET_NAME)
# AWS_S3_CALLING_FORMAT = OrdinaryCallingFormat()

# https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching#cache-control
# Response can be cached by browser and any intermediary caches (i.e. it is "public") for up to 1 day
# 86400 = (60 seconds x 60 minutes x 24 hours)
# AWS_HEADERS = {
#     'Cache-Control': 'max-age=86400, s-maxage=86400, must-revalidate',
# }

# Static files
# STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

# Caching
redis_url = urlparse.urlparse(os.environ.get('REDISTOGO_URL', 'redis://localhost:6379'))
CACHES = {
    'default': {
        'BACKEND': 'redis_cache.RedisCache',
        'LOCATION': '{}:{}'.format(redis_url.hostname, redis_url.port),
        'OPTIONS': {
            'DB': 0,
            'PASSWORD': redis_url.password,
            'PARSER_CLASS': 'redis.connection.HiredisParser',
            'CONNECTION_POOL_CLASS': 'redis.BlockingConnectionPool',
            'CONNECTION_POOL_CLASS_KWARGS': {
                'max_connections': 50,
                'timeout': 20,
            }
        }
    }
}

# Django RQ production settings
RQ_QUEUES = {
    'default': {
        'URL': os.getenv('REDISTOGO_URL', 'redis://localhost:6379'),
        'DB': 0,
        'DEFAULT_TIMEOUT': 500,
    },
}

VERSATILEIMAGEFIELD_SETTINGS['create_images_on_demand'] = False

# 阿里云
DEFAULT_FILE_STORAGE = 'aliyun_oss2_storage.backends.AliyunMediaStorage'
BUCKET_NAME = "hxt-{{cookiecutter.app_name}}-prd"