First commit
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
"""
|
||||
Configuration de base commune à tous les environnements.
|
||||
"""
|
||||
from pathlib import Path
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from decouple import config, Csv
|
||||
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent
|
||||
|
||||
SECRET_KEY = config('SECRET_KEY')
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.sitemaps',
|
||||
'django_resized',
|
||||
'adminsortable2',
|
||||
'properties',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'whitenoise.middleware.WhiteNoiseMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'logis_project.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',
|
||||
'django.template.context_processors.i18n',
|
||||
'properties.context_processors.site_settings',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'logis_project.wsgi.application'
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': 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'},
|
||||
]
|
||||
|
||||
# Internationalisation
|
||||
LANGUAGE_CODE = 'fr'
|
||||
LANGUAGES = [
|
||||
('fr', _('Français')),
|
||||
('en', _('English')),
|
||||
]
|
||||
TIME_ZONE = 'Europe/Paris'
|
||||
USE_I18N = True
|
||||
USE_L10N = True
|
||||
USE_TZ = True
|
||||
LOCALE_PATHS = [BASE_DIR / 'locale']
|
||||
|
||||
# Fichiers statiques
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
||||
STATICFILES_DIRS = [BASE_DIR / 'static']
|
||||
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||
|
||||
# Fichiers médias
|
||||
MEDIA_URL = '/media/'
|
||||
MEDIA_ROOT = BASE_DIR / 'media'
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
# django-resized : configuration par défaut
|
||||
DJANGORESIZED_DEFAULT_SIZE = [1920, 1080]
|
||||
DJANGORESIZED_DEFAULT_SCALE = 1.0
|
||||
DJANGORESIZED_DEFAULT_QUALITY = 85
|
||||
DJANGORESIZED_DEFAULT_KEEP_META = True
|
||||
DJANGORESIZED_DEFAULT_FORCE_FORMAT = 'WEBP'
|
||||
DJANGORESIZED_DEFAULT_FORMAT_EXTENSIONS = {'WEBP': '.webp', 'JPEG': '.jpg'}
|
||||
DJANGORESIZED_DEFAULT_NORMALIZE_ROTATION = True
|
||||
|
||||
# Configuration email (envoi uniquement)
|
||||
EMAIL_BACKEND = config(
|
||||
'EMAIL_BACKEND',
|
||||
default='django.core.mail.backends.smtp.EmailBackend',
|
||||
)
|
||||
EMAIL_HOST = config('EMAIL_HOST', default='localhost')
|
||||
EMAIL_PORT = config('EMAIL_PORT', default=587, cast=int)
|
||||
EMAIL_USE_TLS = config('EMAIL_USE_TLS', default=True, cast=bool)
|
||||
EMAIL_HOST_USER = config('EMAIL_HOST_USER', default='')
|
||||
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD', default='')
|
||||
SITE_DOMAIN = config('SITE_DOMAIN', default='')
|
||||
DEFAULT_FROM_EMAIL = config('DEFAULT_FROM_EMAIL', default='LOGIS <noreply@example.com>')
|
||||
ADMIN_EMAIL = config('ADMIN_EMAIL', default='admin@example.com')
|
||||
|
||||
# Logging
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'handlers': {
|
||||
'console': {'class': 'logging.StreamHandler'},
|
||||
},
|
||||
'root': {
|
||||
'handlers': ['console'],
|
||||
'level': 'WARNING',
|
||||
},
|
||||
'loggers': {
|
||||
'properties': {
|
||||
'handlers': ['console'],
|
||||
'level': 'INFO',
|
||||
'propagate': False,
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user