"""
Django settings for SCIC_BOT_API project.

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

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

For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.2/ref/settings/
"""
import os
from pathlib import Path

# import os
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

# FORCE_SCRIPT_NAME = None

FORCE_SCRIPT_NAME = '/alliBotV5_chatbot'
LOGIN_URL = '/alliBotV5_chatbot/login/'


# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "django-insecure-mijcz8325sd*#tljq&1@4dj#*alx30b$z!a$-w9rs730b0gpe2"

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

ALLOWED_HOSTS = ["*"]
CORS_ORIGIN_ALLOW_ALL = True
CSRF_COOKIE_SECURE = True
CSRF_COOKIE_HTTPONLY = True
SESSION_ENGINE = "django.contrib.sessions.backends.db"
SESSION_COOKIE_NAME = "sessionid"
# SESSION_COOKIE_AGE = 3600  # Session age in seconds
# SESSION_COOKIE_HTTPONLY = True  # Restrict cookie access from JavaScript
# SESSION_COOKIE_SECURE = True
# SESSION_SAVE_EVERY_REQUEST = True


# SESSION_ENGINE = 'django.contrib.sessions.backends.db'  # You can use other backends like 'django.contrib.sessions.backends.db'
# SESSION_ENGINE = "django.contrib.sessions.backends.cache"
# SESSION_COOKIE_AGE = 3600
# SESSION_SERIALIZER = 'ALLI_BOT_API.custom_serializers.custom_dumps'
# SESSION_DESERIALIZER = 'ALLI_BOT_API.custom_serializers.custom_loads'
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
# Application definition

INSTALLED_APPS = [
    "django.contrib.admin",
    "django.contrib.auth",
    "django.contrib.contenttypes",
    "django.contrib.sessions",
    "django.contrib.messages",
    "django.contrib.staticfiles",
    "corsheaders",
    "AlliBotV50",
]

REST_FRAMEWORK = {
    "DEFAULT_PERMISSION_CLASSES": [
        "rest_framework.permissions.AllowAny",
    ],
    "DEFAULT_AUTHENTICATION_CLASSES": [
        "rest_framework.authentication.BasicAuthentication",
    ],
}

MIDDLEWARE = [
    "django.contrib.sessions.middleware.SessionMiddleware",
    "django.middleware.common.CommonMiddleware",
    "django.middleware.csrf.CsrfViewMiddleware",
    "django.contrib.auth.middleware.AuthenticationMiddleware",
    "django.middleware.security.SecurityMiddleware",
    "django.contrib.messages.middleware.MessageMiddleware",
    "django.middleware.clickjacking.XFrameOptionsMiddleware",
    "corsheaders.middleware.CorsMiddleware",
]

ROOT_URLCONF = "AlliBotV5.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",
            ],
        },
    },
]

WSGI_APPLICATION = "AlliBotV5.wsgi.application"


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

DATABASES = {
    "default": {
        "ENGINE": "django.db.backends.sqlite3",
        "NAME": BASE_DIR / "db.sqlite3",
    }
}

# Password validation
# https://docs.djangoproject.com/en/4.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/4.2/topics/i18n/

LANGUAGE_CODE = "en-us"

TIME_ZONE = "UTC"

USE_I18N = True

USE_TZ = True


# STATIC_URL = '/alliBotV5_chatbot/static/'
# STATIC_ROOT = '/var/www/html/AlliBotV5_chatbot/static/'

STATIC_URL = 'static/'
STATIC_ROOT = '/var/www/html/static/'  # You need to define this in your settings


# STATIC_URL = '/static/'
# STATIC_ROOT = BASE_DIR / 'staticfiles'
# STATICFILES_DIRS = [BASE_DIR / 'static','/var/www/html/AlliBotV5_chatbot/static','/var/www/html/AlliBotV5_chatbot/alliBotV5_chatbot/static']

# STATICFILES_DIRS = ['/var/www/html/AlliBotV5_chatbot/alliBotV5_chatbot/static']


# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
