"""
Django settings for papers project.

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

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

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

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
## Documentation for the base directory path
# @brief It specifies the base path of the all files and folders of a project.
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


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

# SECURITY WARNING: keep the secret key used in production secret!
## Documentation for security key
# @brief Security key to be kept private when code used in production!!
SECRET_KEY = '-w-mk58zgjk*y=t61muzzrd+*e)7%+20j__!4_=lh(6^*@)42n'

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

## Documentation for security about DEBUG
# @brief to show the error status while development. Never use debug as true when used in production.
DEBUG = True

ALLOWED_HOSTS = []


# Application definition
## To define Installed apps
# @brief mentioning of all applications used, developer need to add his own project into it. In OUr case we added 'research paper'
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'research_papers',
    'crispy_forms'
]
CRISPY_TEMPLATE_PACK = 'bootstrap4'
#'django.contrib.staticfiles'

## To add the middleware required.
# @brief for our development No need of any change, it was already initialised.
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    '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',
]

## Documentation for ROOT_URLconfig
# @brief to specify the path for urls file where the urlpatterns are being added.
ROOT_URLCONF = 'papers.urls'


## Documentation for Templates
# @brief to specify the templates which has to be set to run the project.
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [],
        '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',
            ],
        },
    },
]

WSGI_APPLICATION = 'papers.wsgi.application'


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


DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
    }
}


## Password validation
# @brief It is used for password validation. Not required in Our case.
# 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',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
## for specifying the language code
LANGUAGE_CODE = 'en-us'
## to specify the different parameters for setting of time zone for server
TIME_ZONE = 'UTC'
## to specify the time zone for server
USE_I18N = True
## to specify the different parameters for setting of time zone for server
USE_L10N = True
## to specify the different parameters for setting of time zone for server
USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
#STATICFILES_DIRS = (os.path.join( os.path.dirname( __file__ ), 'static' ),)


## Documentation for static file directory path
# @brief It is set to create a folder in base directory to store all the static files to be used such as images etc.
STATICFILES_DIRS = (os.path.join( BASE_DIR, 'static' ),)
## Documentation for static file finders
# @brief set to search for existence of any static files in project folder to be added
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',)

STATIC_URL = '/static/'

#STATIC_ROOT = '/path/to/copy/files/to'
#STATIC_ROOT = os.path.join( os.path.dirname( BASE_DIR ), 'static_cdn' )

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

