"""
Django settings for tango_with_django_project project.

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

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

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

import os

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)

# This variable holds the path that ends with Workspace\tango_with_django_project
# which is the base directory for the project. This is done by using os.path.dirname()
# twice on __file__ which leads to stripping 2 parts of the path of this python file,
# which leaves C:\Users\aidan\Workspace\tango_with_django_project . 
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))


# This variable holds the absolute path to the templates directory, by joining
# \templates onto the base directory
TEMPLATE_DIR = os.path.join(BASE_DIR, 'templates')

# This will provide an absolute path to the location where static files are kept
# by using the same process to join the path as above 
STATIC_DIR = os.path.join(BASE_DIR, 'static')

# This will create and store the path of the directory where all media
# files will be stored
MEDIA_DIR = os.path.join(BASE_DIR, 'media')


# These variables will be picked up by django in order to set up media file hosting
# MEDIA_ROOT informs django where to look in your filesystem for media files 
MEDIA_ROOT = MEDIA_DIR

# MEDIA_URL informs django of the URL these media files are to be served from 
MEDIA_URL = '/media/'

# this ensures that any user who tries to acces a resticted page for logged in users
# is redirected to this url
LOGIN_URL = '/rango/login/'






# This is a list of paths with which Django can expect to find static files in
# that can be served. 
STATICFILES_DIRS = [STATIC_DIR, ]






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

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'i^ieoq1ppq!25l)v)1jh!bq-^s&)1xq&+zk6%ji954+o=ty^-o'

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

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'rango',
]

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',
]

ROOT_URLCONF = 'tango_with_django_project.urls'

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [TEMPLATE_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',
                'django.template.context_processors.media'
            ],
        },
    },
]

WSGI_APPLICATION = 'tango_with_django_project.wsgi.application'


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

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


# Password validation
# https://docs.djangoproject.com/en/1.11/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/1.11/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.11/howto/static-files/

STATIC_URL = '/static/'
print("BASE", BASE_DIR)
print(__file__)
print(os.path.dirname(__file__))
print(os.path.dirname(os.path.dirname(__file__)))

