Files
ihrm/horilla/settings.py
Nikhil Ravi Cybrosys e1794e7422 [UPDT]translations in the views (#4)
[UPDT]Translations in the views
[FIX]major bug fixes
2023-05-18 15:05:28 +05:30

225 lines
5.2 KiB
Python
Executable File

"""
Django settings for horilla project.
Generated by 'django-admin startproject' using Django 4.1.4.
For more information on this file, see
https://docs.djangoproject.com/en/4.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.1/ref/settings/
"""
from pathlib import Path
import os
from django.contrib.messages import constants as messages
from os.path import join
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-j8op9)1q8$1&0^s&p*_0%d#pr@w9qj@1o=3#@d=a(^@9@zd@%j'
# 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',
'notifications',
'mathfilters',
'corsheaders',
'simple_history',
'django_filters',
'base',
'recruitment',
'employee',
'leave',
'pms',
'onboarding',
'asset',
'attendance',
'widget_tweaks',
"django_apscheduler",
]
APSCHEDULER_DATETIME_FORMAT = "N j, Y, f:s a"
APSCHEDULER_RUN_NOW_TIMEOUT = 25 # Seconds
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'corsheaders.middleware.CorsMiddleware',
'simple_history.middleware.HistoryRequestMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'horilla.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
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 = 'horilla.wsgi.application'
# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/4.1/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.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Kolkata'
USE_I18N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/
STATIC_URL = 'static/'
STATIC_ROOT = '/static/'
STATICFILES_DIRS = [
BASE_DIR / "static",
]
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
MESSAGE_TAGS = {
messages.DEBUG: 'oh-alert--warning',
messages.INFO: 'oh-alert--info',
messages.SUCCESS: 'oh-alert--success',
messages.WARNING: 'oh-alert--warning',
messages.ERROR: 'oh-alert--danger',
}
CORS_ALLOWED_ORIGINS = [
"http://localhost:8000",
]
LOGIN_URL = '/login'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '<email_address>'
EMAIL_HOST_PASSWORD = '<password>'
SIMPLE_HISTORY_REVERT_DISABLED=True
DJANGO_NOTIFICATIONS_CONFIG = {
'USE_JSONFIELD': True,
'SOFT_DELETE': True,
'USE_WATCHED': True,
'NOTIFICATIONS_STORAGE': 'notifications.storage.DatabaseStorage',
'TEMPLATE': 'notifications.html', # Add this line
}
X_FRAME_OPTIONS = 'SAMEORIGIN'
LANGUAGES = (
('en', 'English (US)'),
('de', 'Deutsche'),
('es','Spanish'),
('fr','France'),
('ar', 'عربى'),
)
LANGUAGE_CODE = 'en-us'
LOCALE_PATHS = [
join(BASE_DIR, 'horilla', 'locale'),
]
TIME_ZONE = 'Asia/Kolkata'
USE_I18N = True
USE_L10N = True
USE_TZ = True