| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- """
- Django settings for gestion_reservas project.
- Generated by 'django-admin startproject' using Django 5.1.1.
- For more information on this file, see
- https://docs.djangoproject.com/en/5.1/topics/settings/
- For the full list of settings and their values, see
- https://docs.djangoproject.com/en/5.1/ref/settings/
- """
- from pathlib import Path
- import os
- import logging
- APP_NAME = "jugaralpadel.es"
- APP_VERSION = os.environ.get("APP_VERSION", "15.0.5") # Valor por defecto si no está definido
- IMG_VERSION = os.environ.get("IMG_VERSION", "0.0.0-dev") # Valor por defecto si no está definido
- MES_COMIENZO_TEMPORADA = int(os.getenv('MES_COMIENZO_TEMPORADA', '9')) # valor por defecto: septiembre
- # 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/5.1/howto/deployment/checklist/
- # SECURITY WARNING: keep the secret key used in production secret!
- SECRET_KEY = 'hey'
- # SECURITY WARNING: don't run with debug turned on in production!
- DEBUG = os.environ.get('DEBUG', 'False') == 'True'
- OPENSHIFT = os.environ.get('OPENSHIFT', 'False') == 'True'
- LOCAL = os.environ.get('LOCAL', 'False') == 'True'
- ALLOWED_HOSTS = [".ocp-cluster.reymota.lab", "jugaralpadel.rancher.reymota.lab", "jugaralpadel.es", ".reymota.es"]
- CSRF_TRUSTED_ORIGINS = ["https://*.ocp-cluster.reymota.lab", "http://jugaralpadel.rancher.reymota.lab", "https://jugaralpadel.rancher.reymota.lab", "https://jugaralpadel.es", "https://*.reymota.es"]
- # Application definition
- INSTALLED_APPS = [
- 'django.contrib.admin',
- 'django.contrib.auth',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.messages',
- 'django.contrib.staticfiles',
- 'eventos',
- 'gestion_reservas',
- 'reymotausers',
- 'rest_framework',
- ]
- 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 = 'gestion_reservas.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',
- 'gestion_reservas.context_processors.app_version',
- ],
- 'libraries': {
- 'filtros_de_entorno': 'gestion_reservas.templatetags.filtros_de_entorno',
- }
- },
- },
- ]
- WSGI_APPLICATION = 'gestion_reservas.wsgi.application'
- # Database
- # https://docs.djangoproject.com/en/5.1/ref/settings/#databases
- if LOCAL is False:
- DATABASES = {
- "default": {
- "ENGINE": "django.db.backends.postgresql",
- "NAME": "jugaralpadel",
- "USER": "creylopez",
- "PASSWORD": "Dsa-0213",
- "HOST": "postgresql",
- "PORT": "5432",
- }
- }
- else:
- DATABASES = {
- 'default': {
- "ENGINE": "django.db.backends.sqlite3",
- "NAME": BASE_DIR / "db.sqlite3",
- }
- }
- # Password validation
- # https://docs.djangoproject.com/en/5.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/5.1/topics/i18n/
- LANGUAGE_CODE = 'es-es'
- TIME_ZONE = 'Europe/Madrid'
- USE_I18N = True
- USE_TZ = True
- I18N = True
- L10N = True
- DECIMAL_SEPARATOR = ','
- THOUSAND_SEPARATOR = '.'
- # Static files (CSS, JavaScript, Images)
- # https://docs.djangoproject.com/en/5.1/howto/static-files/
- STATIC_URL = 'static/'
- STATIC_ROOT = BASE_DIR / "staticfiles"
- # STATICFILES_DIRS = [BASE_DIR / "eventos/static",]
- # Mediafiles
- MEDIA_ROOT = BASE_DIR / "mediafiles"
- MEDIA_URL = '/media/'
- # Default primary key field type
- # https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
- DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
- LOGIN_URL = '/accounts/login/'
- LOGIN_REDIRECT_URL = 'principal'
- LOGOUT_REDIRECT_URL = 'principal'
- AUTH_USER_MODEL = "reymotausers.ReyMotaUser"
- # Configuración de correo con Gmail
- if DEBUG is True:
- EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
- else:
- EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
- EMAIL_HOST = 'smtp.gmail.com'
- EMAIL_PORT = 587
- EMAIL_USE_TLS = True
- EMAIL_HOST_USER = 'jugaralpadelentreamigos@gmail.com'
- EMAIL_HOST_PASSWORD = 'btjnlcliimxcnmhi' # Es mejor usar una contraseña de aplicación de Google
- DEFAULT_FROM_EMAIL = 'jugaralpadelentreamigos@gmail.com'
- # Dirección del administrador
- # ADMIN_EMAIL = 'king.bernard.b@gmail.com'
- ADMIN_EMAIL = ''
- # El tiempo de validez del enlace para resetear la contraseña (por defecto es de 3 días)
- PASSWORD_RESET_TIMEOUT = 86400 # 1 día en segundos
- LOGGING = {
- 'version': 1,
- 'disable_existing_loggers': False,
- 'formatters': {
- 'verbose': {
- 'format': '{levelname} {asctime} {module} {message}',
- 'style': '{',
- },
- 'simple': {
- 'format': '{levelname} {message}',
- 'style': '{',
- },
- },
- 'handlers': {
- 'console': {
- 'level': 'DEBUG',
- 'class': 'logging.StreamHandler',
- 'formatter': 'simple',
- },
- 'file': {
- 'level': 'DEBUG',
- 'class': 'logging.FileHandler',
- 'filename': '/dev/null',
- 'formatter': 'verbose',
- },
- 'mail_admins': {
- 'level': 'ERROR',
- 'class': 'django.utils.log.AdminEmailHandler',
- },
- },
- 'loggers': {
- 'django': {
- 'handlers': ['file'],
- 'level': 'DEBUG',
- 'propagate': True,
- },
- 'eventos': {
- 'handlers': ['console', 'file'],
- 'level': 'DEBUG',
- 'propagate': False,
- },
- 'gestion_reservas': {
- 'handlers': ['console', 'file'],
- 'level': 'DEBUG',
- 'propagate': False,
- },
- 'django.request': {
- 'handlers': ['mail_admins'],
- 'level': 'ERROR',
- 'propagate': False,
- },
- },
- }
|