|
|
@@ -12,6 +12,13 @@ https://docs.djangoproject.com/en/5.2/ref/settings/
|
|
|
|
|
|
import os
|
|
|
from pathlib import Path
|
|
|
+import logging
|
|
|
+
|
|
|
+
|
|
|
+APP_NAME = "Finanzas"
|
|
|
+APP_VERSION = os.environ.get("APP_VERSION", "0.0.0-dev") # 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
|
|
|
+
|
|
|
|
|
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
|
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
|
|
@@ -25,8 +32,9 @@ SECRET_KEY = 'django-insecure-^9*3@g$5brgjmhv&h!h*)c9kp)8i5tnqee_eu+fi728@g96#8&
|
|
|
|
|
|
# SECURITY WARNING: don't run with debug turned on in production!
|
|
|
DEBUG = True
|
|
|
+OPENSHIFT = os.environ["OPENSHIFT"] == 'True'
|
|
|
|
|
|
-ALLOWED_HOSTS = []
|
|
|
+ALLOWED_HOSTS = [".ocp-cluster.reymota.lab", ".reymota.es", ".reymota.lab"]
|
|
|
|
|
|
|
|
|
# Application definition
|
|
|
@@ -38,8 +46,11 @@ INSTALLED_APPS = [
|
|
|
'django.contrib.sessions',
|
|
|
'django.contrib.messages',
|
|
|
'django.contrib.staticfiles',
|
|
|
+
|
|
|
'finanzas',
|
|
|
'reymotausers',
|
|
|
+
|
|
|
+ 'rest_framework',
|
|
|
]
|
|
|
|
|
|
MIDDLEWARE = [
|
|
|
@@ -64,7 +75,11 @@ TEMPLATES = [
|
|
|
'django.template.context_processors.request',
|
|
|
'django.contrib.auth.context_processors.auth',
|
|
|
'django.contrib.messages.context_processors.messages',
|
|
|
+ 'misfinanzas.context_processors.app_version',
|
|
|
],
|
|
|
+ 'libraries': {
|
|
|
+ 'filtros_de_entorno': 'misfinanzas.templatetags.filtros_de_entorno',
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
]
|
|
|
@@ -77,8 +92,12 @@ WSGI_APPLICATION = 'misfinanzas.wsgi.application'
|
|
|
|
|
|
DATABASES = {
|
|
|
'default': {
|
|
|
- 'ENGINE': 'django.db.backends.sqlite3',
|
|
|
- 'NAME': BASE_DIR / 'db.sqlite3',
|
|
|
+ "ENGINE": "django.db.backends.postgresql",
|
|
|
+ "NAME": "finanzas",
|
|
|
+ "USER": "creylopez",
|
|
|
+ "PASSWORD": "Dsa-0213",
|
|
|
+ "HOST": "postgresql",
|
|
|
+ "PORT": "5432",
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -107,11 +126,15 @@ AUTH_PASSWORD_VALIDATORS = [
|
|
|
|
|
|
LANGUAGE_CODE = 'es-es'
|
|
|
|
|
|
-TIME_ZONE = 'UTC'
|
|
|
+TIME_ZONE = 'Europe/Madrid'
|
|
|
|
|
|
USE_I18N = True
|
|
|
|
|
|
USE_TZ = True
|
|
|
+I18N = True
|
|
|
+L10N = True
|
|
|
+DECIMAL_SEPARATOR = ','
|
|
|
+THOUSAND_SEPARATOR = '.'
|
|
|
|
|
|
|
|
|
# Static files (CSS, JavaScript, Images)
|
|
|
@@ -119,9 +142,12 @@ USE_TZ = True
|
|
|
|
|
|
STATIC_URL = 'static/'
|
|
|
STATIC_ROOT = BASE_DIR / "staticfiles"
|
|
|
-STATICFILES_DIRS = [
|
|
|
- BASE_DIR / "static",
|
|
|
-]
|
|
|
+STATICFILES_DIRS = [BASE_DIR / "static",]
|
|
|
+
|
|
|
+# Mediafiles
|
|
|
+
|
|
|
+MEDIA_ROOT = BASE_DIR / "mediafiles"
|
|
|
+MEDIA_URL = '/media/'
|
|
|
|
|
|
# Default primary key field type
|
|
|
# https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
|
|
|
@@ -135,3 +161,57 @@ LOGOUT_REDIRECT_URL = 'dashboard'
|
|
|
AUTH_USER_MODEL = "reymotausers.ReyMotaUser"
|
|
|
|
|
|
CSRF_TRUSTED_ORIGINS = ["https://*.ocp-cluster.reymota.lab", "https://*.reymota.es", "http://*.rancher.reymota.lab"]
|
|
|
+
|
|
|
+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,
|
|
|
+ },
|
|
|
+ 'repostajes': {
|
|
|
+ 'handlers': ['console', 'file'],
|
|
|
+ 'level': 'DEBUG',
|
|
|
+ 'propagate': False,
|
|
|
+ },
|
|
|
+ 'lyrics': {
|
|
|
+ 'handlers': ['console', 'file'],
|
|
|
+ 'level': 'DEBUG',
|
|
|
+ 'propagate': False,
|
|
|
+ },
|
|
|
+ 'django.request': {
|
|
|
+ 'handlers': ['mail_admins'],
|
|
|
+ 'level': 'ERROR',
|
|
|
+ 'propagate': False,
|
|
|
+ },
|
|
|
+ },
|
|
|
+}
|