import os
import dj_database_url
from django.contrib.messages import constants as messages
from decouple import config, Csv

ENVIRONMENT = config("ENVIRONMENT")

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = config('SECRET_KEY')
DEBUG = config('DEBUG', False, cast=bool)
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default="127.0.0.1", cast=Csv())
PROJECT_APPS = [
    'clients',
    'projects',
    'authentication',
    'custom_errors',
    'oauth_app'
]

ALL_AUTH_APPS = [
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.google',
]
DJANGO_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.humanize',
    'django.contrib.sites',
    'crispy_forms',
    'javascript_settings',
    'storages',
]
INSTALLED_APPS = PROJECT_APPS + DJANGO_APPS + ALL_AUTH_APPS

CRISPY_TEMPLATE_PACK = 'bootstrap3'


MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'whitenoise.middleware.WhiteNoiseMiddleware',  # For heroku
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'login_required.middleware.LoginRequiredMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',

]

MESSAGE_TAGS = {
    messages.ERROR: 'danger'
}

ROOT_URLCONF = 'project_manager.urls'
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        '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',
                'django.template.context_processors.request',
            ],
        },
    },
]

WSGI_APPLICATION = 'project_manager.wsgi.application'

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

if ENVIRONMENT == "digital_ocean":
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
            'NAME': config("POSTGRES_DB"),
            'USER': config("POSTGRES_USER"),
            'PASSWORD': config("POSTGRES_PASSWORD"),
            'HOST': config("HOST"),
            'PORT': '',
        }
    }
elif ENVIRONMENT == "heroku":
    # postgres database
    DATABASES = {
        'default': dj_database_url.config(default=config("POSTGRES_URI"))
    }
else:
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
        }
    }

# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

AUTHENTICATION_BACKENDS = [
    'django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend'
]

# SOCIAL LOGIN
SOCIALACCOUNT_ADAPTER = 'authentication.google_auth_adapter.GoogleAuthAdapter'
SOCIALACCOUNT_PROVIDERS = {
    'google': {
        'SCOPE': [
            'profile',
            'email',
        ],
        'AUTH_PARAMS': {
            'access_type': 'online',
        }
    }
}

SITE_ID = config("SITE_ID")
if not DEBUG:
    ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Africa/Kampala'

USE_I18N = True

USE_L10N = True

USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static_files')
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static')
]

if DEBUG:
    # media
    MEDIA_URL = '/media/'
    MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
else:
    # Production
    # Static files (CSS, JavaScript, Images)
    # https://docs.djangoproject.com/en/1.11/howto/static-files/
    AWS_ACCESS_KEY_ID = config("AWS_ACCESS_KEY_ID")
    AWS_SECRET_ACCESS_KEY = config("AWS_SECRET_ACCESS_KEY")
    AWS_STORAGE_BUCKET_NAME = config("AWS_STORAGE_BUCKET_NAME")
    AWS_S3_ENDPOINT_URL = config("AWS_S3_ENDPOINT_URL")
    AWS_S3_OBJECT_PARAMETERS = {
        'CacheControl': 'max-age=86400',
    }
    AWS_LOCATION = config("AWS_LOCATION")
    # Media Storage
    DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

SENDGRID_API_KEY = config('SENDGRID_API_KEY')
EMAIL_HOST = config('EMAIL_HOST')
EMAIL_HOST_USER = 'apikey'
EMAIL_HOST_PASSWORD = SENDGRID_API_KEY
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = config("DEFAULT_FROM_EMAIL")

# CELERY STUFF
CELERY_TIMEZONE = config('CELERY_TIMEZONE', default="Africa/Kampala")
LOGIN_REDIRECT_URL = 'dashboard_page'
LOGIN_URL = 'login'
LOGOUT_URL = 'logout'
LOGIN_REQUIRED_IGNORE_VIEW_NAMES = [
    'logout',
    'login',
    'password_reset',
    'password_reset_done',
    'password_reset_confirm',
    'password_reset_complete',
    'social_auth'
]

LOGIN_REQUIRED_IGNORE_PATHS = [
    r'/auth/accounts/',
]

AUTH_USER_MODEL = "projects.User"

b9b67b1a940c1880b8d97b6dc38558ececc23263
<mask token>

<mask token>
if ENVIRONMENT == 'digital_ocean':
    DATABASES = {'default': {'ENGINE':
        'django.db.backends.postgresql_psycopg2', 'NAME': config(
        'POSTGRES_DB'), 'USER': config('POSTGRES_USER'), 'PASSWORD': config
        ('POSTGRES_PASSWORD'), 'HOST': config('HOST'), 'PORT': ''}}
elif ENVIRONMENT == 'heroku':
    DATABASES = {'default': dj_database_url.config(default=config(
        'POSTGRES_URI'))}
else:
    DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME':
        os.path.join(BASE_DIR, 'db.sqlite3')}}
<mask token>
if not DEBUG:
    ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'
<mask token>
if DEBUG:
    MEDIA_URL = '/media/'
    MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
else:
    AWS_ACCESS_KEY_ID = config('AWS_ACCESS_KEY_ID')
    AWS_SECRET_ACCESS_KEY = config('AWS_SECRET_ACCESS_KEY')
    AWS_STORAGE_BUCKET_NAME = config('AWS_STORAGE_BUCKET_NAME')
    AWS_S3_ENDPOINT_URL = config('AWS_S3_ENDPOINT_URL')
    AWS_S3_OBJECT_PARAMETERS = {'CacheControl': 'max-age=86400'}
    AWS_LOCATION = config('AWS_LOCATION')
    DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
<mask token>

<mask token>
ENVIRONMENT = config('ENVIRONMENT')
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = config('SECRET_KEY')
DEBUG = config('DEBUG', False, cast=bool)
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='127.0.0.1', cast=Csv())
PROJECT_APPS = ['clients', 'projects', 'authentication', 'custom_errors',
    'oauth_app']
ALL_AUTH_APPS = ['allauth', 'allauth.account', 'allauth.socialaccount',
    'allauth.socialaccount.providers.google']
DJANGO_APPS = ['django.contrib.admin', 'django.contrib.auth',
    'django.contrib.contenttypes', 'django.contrib.sessions',
    'django.contrib.messages', 'django.contrib.staticfiles',
    'django.contrib.humanize', 'django.contrib.sites', 'crispy_forms',
    'javascript_settings', 'storages']
INSTALLED_APPS = PROJECT_APPS + DJANGO_APPS + ALL_AUTH_APPS
CRISPY_TEMPLATE_PACK = 'bootstrap3'
MIDDLEWARE = ['django.middleware.security.SecurityMiddleware',
    'whitenoise.middleware.WhiteNoiseMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'login_required.middleware.LoginRequiredMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware']
MESSAGE_TAGS = {messages.ERROR: 'danger'}
ROOT_URLCONF = 'project_manager.urls'
TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [os.path.join(BASE_DIR, 'templates')], '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',
    'django.template.context_processors.request']}}]
WSGI_APPLICATION = 'project_manager.wsgi.application'
if ENVIRONMENT == 'digital_ocean':
    DATABASES = {'default': {'ENGINE':
        'django.db.backends.postgresql_psycopg2', 'NAME': config(
        'POSTGRES_DB'), 'USER': config('POSTGRES_USER'), 'PASSWORD': config
        ('POSTGRES_PASSWORD'), 'HOST': config('HOST'), 'PORT': ''}}
elif ENVIRONMENT == 'heroku':
    DATABASES = {'default': dj_database_url.config(default=config(
        'POSTGRES_URI'))}
else:
    DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME':
        os.path.join(BASE_DIR, 'db.sqlite3')}}
AUTH_PASSWORD_VALIDATORS = [{'NAME':
    'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'
    }, {'NAME':
    'django.contrib.auth.password_validation.MinimumLengthValidator'}, {
    'NAME':
    'django.contrib.auth.password_validation.CommonPasswordValidator'}, {
    'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator'}
    ]
AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend']
SOCIALACCOUNT_ADAPTER = 'authentication.google_auth_adapter.GoogleAuthAdapter'
SOCIALACCOUNT_PROVIDERS = {'google': {'SCOPE': ['profile', 'email'],
    'AUTH_PARAMS': {'access_type': 'online'}}}
SITE_ID = config('SITE_ID')
if not DEBUG:
    ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Africa/Kampala'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static_files')
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
if DEBUG:
    MEDIA_URL = '/media/'
    MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
else:
    AWS_ACCESS_KEY_ID = config('AWS_ACCESS_KEY_ID')
    AWS_SECRET_ACCESS_KEY = config('AWS_SECRET_ACCESS_KEY')
    AWS_STORAGE_BUCKET_NAME = config('AWS_STORAGE_BUCKET_NAME')
    AWS_S3_ENDPOINT_URL = config('AWS_S3_ENDPOINT_URL')
    AWS_S3_OBJECT_PARAMETERS = {'CacheControl': 'max-age=86400'}
    AWS_LOCATION = config('AWS_LOCATION')
    DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
SENDGRID_API_KEY = config('SENDGRID_API_KEY')
EMAIL_HOST = config('EMAIL_HOST')
EMAIL_HOST_USER = 'apikey'
EMAIL_HOST_PASSWORD = SENDGRID_API_KEY
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = config('DEFAULT_FROM_EMAIL')
CELERY_TIMEZONE = config('CELERY_TIMEZONE', default='Africa/Kampala')
LOGIN_REDIRECT_URL = 'dashboard_page'
LOGIN_URL = 'login'
LOGOUT_URL = 'logout'
LOGIN_REQUIRED_IGNORE_VIEW_NAMES = ['logout', 'login', 'password_reset',
    'password_reset_done', 'password_reset_confirm',
    'password_reset_complete', 'social_auth']
LOGIN_REQUIRED_IGNORE_PATHS = ['/auth/accounts/']
AUTH_USER_MODEL = 'projects.User'

import os
import dj_database_url
from django.contrib.messages import constants as messages
from decouple import config, Csv
ENVIRONMENT = config('ENVIRONMENT')
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = config('SECRET_KEY')
DEBUG = config('DEBUG', False, cast=bool)
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default='127.0.0.1', cast=Csv())
PROJECT_APPS = ['clients', 'projects', 'authentication', 'custom_errors',
    'oauth_app']
ALL_AUTH_APPS = ['allauth', 'allauth.account', 'allauth.socialaccount',
    'allauth.socialaccount.providers.google']
DJANGO_APPS = ['django.contrib.admin', 'django.contrib.auth',
    'django.contrib.contenttypes', 'django.contrib.sessions',
    'django.contrib.messages', 'django.contrib.staticfiles',
    'django.contrib.humanize', 'django.contrib.sites', 'crispy_forms',
    'javascript_settings', 'storages']
INSTALLED_APPS = PROJECT_APPS + DJANGO_APPS + ALL_AUTH_APPS
CRISPY_TEMPLATE_PACK = 'bootstrap3'
MIDDLEWARE = ['django.middleware.security.SecurityMiddleware',
    'whitenoise.middleware.WhiteNoiseMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'login_required.middleware.LoginRequiredMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware']
MESSAGE_TAGS = {messages.ERROR: 'danger'}
ROOT_URLCONF = 'project_manager.urls'
TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [os.path.join(BASE_DIR, 'templates')], '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',
    'django.template.context_processors.request']}}]
WSGI_APPLICATION = 'project_manager.wsgi.application'
if ENVIRONMENT == 'digital_ocean':
    DATABASES = {'default': {'ENGINE':
        'django.db.backends.postgresql_psycopg2', 'NAME': config(
        'POSTGRES_DB'), 'USER': config('POSTGRES_USER'), 'PASSWORD': config
        ('POSTGRES_PASSWORD'), 'HOST': config('HOST'), 'PORT': ''}}
elif ENVIRONMENT == 'heroku':
    DATABASES = {'default': dj_database_url.config(default=config(
        'POSTGRES_URI'))}
else:
    DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME':
        os.path.join(BASE_DIR, 'db.sqlite3')}}
AUTH_PASSWORD_VALIDATORS = [{'NAME':
    'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'
    }, {'NAME':
    'django.contrib.auth.password_validation.MinimumLengthValidator'}, {
    'NAME':
    'django.contrib.auth.password_validation.CommonPasswordValidator'}, {
    'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator'}
    ]
AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend']
SOCIALACCOUNT_ADAPTER = 'authentication.google_auth_adapter.GoogleAuthAdapter'
SOCIALACCOUNT_PROVIDERS = {'google': {'SCOPE': ['profile', 'email'],
    'AUTH_PARAMS': {'access_type': 'online'}}}
SITE_ID = config('SITE_ID')
if not DEBUG:
    ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'https'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Africa/Kampala'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static_files')
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
if DEBUG:
    MEDIA_URL = '/media/'
    MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
else:
    AWS_ACCESS_KEY_ID = config('AWS_ACCESS_KEY_ID')
    AWS_SECRET_ACCESS_KEY = config('AWS_SECRET_ACCESS_KEY')
    AWS_STORAGE_BUCKET_NAME = config('AWS_STORAGE_BUCKET_NAME')
    AWS_S3_ENDPOINT_URL = config('AWS_S3_ENDPOINT_URL')
    AWS_S3_OBJECT_PARAMETERS = {'CacheControl': 'max-age=86400'}
    AWS_LOCATION = config('AWS_LOCATION')
    DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
SENDGRID_API_KEY = config('SENDGRID_API_KEY')
EMAIL_HOST = config('EMAIL_HOST')
EMAIL_HOST_USER = 'apikey'
EMAIL_HOST_PASSWORD = SENDGRID_API_KEY
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = config('DEFAULT_FROM_EMAIL')
CELERY_TIMEZONE = config('CELERY_TIMEZONE', default='Africa/Kampala')
LOGIN_REDIRECT_URL = 'dashboard_page'
LOGIN_URL = 'login'
LOGOUT_URL = 'logout'
LOGIN_REQUIRED_IGNORE_VIEW_NAMES = ['logout', 'login', 'password_reset',
    'password_reset_done', 'password_reset_confirm',
    'password_reset_complete', 'social_auth']
LOGIN_REQUIRED_IGNORE_PATHS = ['/auth/accounts/']
AUTH_USER_MODEL = 'projects.User'

import os
import dj_database_url
from django.contrib.messages import constants as messages
from decouple import config, Csv

ENVIRONMENT = config("ENVIRONMENT")

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = config('SECRET_KEY')
DEBUG = config('DEBUG', False, cast=bool)
ALLOWED_HOSTS = config('ALLOWED_HOSTS', default="127.0.0.1", cast=Csv())
PROJECT_APPS = [
    'clients',
    'projects',
    'authentication',
    'custom_errors',
    'oauth_app'
]

ALL_AUTH_APPS = [
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'allauth.socialaccount.providers.google',
]
DJANGO_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.humanize',
    'django.contrib.sites',
    'crispy_forms',
    'javascript_settings',
    'storages',
]
INSTALLED_APPS = PROJECT_APPS + DJANGO_APPS + ALL_AUTH_APPS

CRISPY_TEMPLATE_PACK = 'bootstrap3'


MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'whitenoise.middleware.WhiteNoiseMiddleware',  # For heroku
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'login_required.middleware.LoginRequiredMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',

]

MESSAGE_TAGS = {
    messages.ERROR: 'danger'
}

ROOT_URLCONF = 'project_manager.urls'
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates')],
        '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',
                'django.template.context_processors.request',
            ],
        },
    },
]

WSGI_APPLICATION = 'project_manager.wsgi.application'

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

if ENVIRONMENT == "digital_ocean":
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.postgresql_psycopg2',
            'NAME': config("POSTGRES_DB"),
            'USER': config("POSTGRES_USER"),
            'PASSWORD': config("POSTGRES_PASSWORD"),
            'HOST': config("HOST"),
            'PORT': '',
        }
    }
elif ENVIRONMENT == "heroku":
    # postgres database
    DATABASES = {
        'default': dj_database_url.config(default=config("POSTGRES_URI"))
    }
else:
    DATABASES = {
        'default': {
            'ENGINE': 'django.db.backends.sqlite3',
            'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
        }
    }

# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
    {
        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]

AUTHENTICATION_BACKENDS = [
    'django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend'
]

# SOCIAL LOGIN
SOCIALACCOUNT_ADAPTER = 'authentication.google_auth_adapter.GoogleAuthAdapter'
SOCIALACCOUNT_PROVIDERS = {
    'google': {
        'SCOPE': [
            'profile',
            'email',
        ],
        'AUTH_PARAMS': {
            'access_type': 'online',
        }
    }
}

SITE_ID = config("SITE_ID")
if not DEBUG:
    ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'Africa/Kampala'

USE_I18N = True

USE_L10N = True

USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static_files')
STATICFILES_DIRS = [
    os.path.join(BASE_DIR, 'static')
]

if DEBUG:
    # media
    MEDIA_URL = '/media/'
    MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
else:
    # Production
    # Static files (CSS, JavaScript, Images)
    # https://docs.djangoproject.com/en/1.11/howto/static-files/
    AWS_ACCESS_KEY_ID = config("AWS_ACCESS_KEY_ID")
    AWS_SECRET_ACCESS_KEY = config("AWS_SECRET_ACCESS_KEY")
    AWS_STORAGE_BUCKET_NAME = config("AWS_STORAGE_BUCKET_NAME")
    AWS_S3_ENDPOINT_URL = config("AWS_S3_ENDPOINT_URL")
    AWS_S3_OBJECT_PARAMETERS = {
        'CacheControl': 'max-age=86400',
    }
    AWS_LOCATION = config("AWS_LOCATION")
    # Media Storage
    DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'

SENDGRID_API_KEY = config('SENDGRID_API_KEY')
EMAIL_HOST = config('EMAIL_HOST')
EMAIL_HOST_USER = 'apikey'
EMAIL_HOST_PASSWORD = SENDGRID_API_KEY
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = config("DEFAULT_FROM_EMAIL")

# CELERY STUFF
CELERY_TIMEZONE = config('CELERY_TIMEZONE', default="Africa/Kampala")
LOGIN_REDIRECT_URL = 'dashboard_page'
LOGIN_URL = 'login'
LOGOUT_URL = 'logout'
LOGIN_REQUIRED_IGNORE_VIEW_NAMES = [
    'logout',
    'login',
    'password_reset',
    'password_reset_done',
    'password_reset_confirm',
    'password_reset_complete',
    'social_auth'
]

LOGIN_REQUIRED_IGNORE_PATHS = [
    r'/auth/accounts/',
]

AUTH_USER_MODEL = "projects.User"
