From 85246b6bbdbb677cf5689fe11abdd53fd8694399 Mon Sep 17 00:00:00 2001 From: juanjo <130799031+juanminguezsanz2023@users.noreply.github.com> Date: Sat, 11 Apr 2026 18:46:15 +0200 Subject: [PATCH 1/6] Update docker-compose.yml --- deployments/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployments/docker-compose.yml b/deployments/docker-compose.yml index cfc8f56..9e7a191 100644 --- a/deployments/docker-compose.yml +++ b/deployments/docker-compose.yml @@ -8,7 +8,7 @@ services: environment: - DEBUG=${DEBUG_MODE} # Usamos 'gitea-db-1' que es el nombre real y seguro - - DATABASE_URL=postgres://gitea:gitea_password@gitea-db-1:5432/gitea + - DATABASE_URL=postgres://gitea:gitea@gitea-db-1:5432/gitea networks: - gitea_net # Nombre interno para este archivo ports: From 781bb216a3057bbc6f9675103ada2a51257ac05e Mon Sep 17 00:00:00 2001 From: juanjo <130799031+juanminguezsanz2023@users.noreply.github.com> Date: Sat, 11 Apr 2026 18:56:35 +0200 Subject: [PATCH 2/6] Update docker-compose.yml --- deployments/docker-compose.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/deployments/docker-compose.yml b/deployments/docker-compose.yml index 9e7a191..f470342 100644 --- a/deployments/docker-compose.yml +++ b/deployments/docker-compose.yml @@ -6,9 +6,15 @@ services: container_name: ${CONTAINER_NAME} restart: always environment: - - DEBUG=${DEBUG_MODE} - # Usamos 'gitea-db-1' que es el nombre real y seguro - - DATABASE_URL=postgres://gitea:gitea@gitea-db-1:5432/gitea + - DEBUG=${DEBUG_MODE} + # Piezas sueltas para Django: + - DB_NAME=gitea + - DB_USER=gitea + - DB_PASSWORD=gitea + - DB_HOST=gitea-db-1 + - DB_PORT=5432 + # Mantenemos esta por si acaso la usas en otro sitio: + - DATABASE_URL=postgres://gitea:gitea@gitea-db-1:5432/gitea networks: - gitea_net # Nombre interno para este archivo ports: From 7e1755ded09eb1a14e91300c9b2dafa9eb06e7a0 Mon Sep 17 00:00:00 2001 From: juanjo <130799031+juanminguezsanz2023@users.noreply.github.com> Date: Sat, 11 Apr 2026 19:07:22 +0200 Subject: [PATCH 3/6] fix 2 --- core/asgi.py | 4 ++++ core/wsgi.py | 7 +++++++ 2 files changed, 11 insertions(+) create mode 100644 core/asgi.py create mode 100644 core/wsgi.py diff --git a/core/asgi.py b/core/asgi.py new file mode 100644 index 0000000..7de2e6f --- /dev/null +++ b/core/asgi.py @@ -0,0 +1,4 @@ +import os +from django.core.asgi import get_asgi_application +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') +application = get_asgi_application() \ No newline at end of file diff --git a/core/wsgi.py b/core/wsgi.py new file mode 100644 index 0000000..38e1de4 --- /dev/null +++ b/core/wsgi.py @@ -0,0 +1,7 @@ +import os +from django.core.wsgi import get_wsgi_application + +# Este es el enlace con tus configuraciones +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'core.settings') + +application = get_wsgi_application() \ No newline at end of file From f003137cd8e089e462c87d6142113a15e82fb5f9 Mon Sep 17 00:00:00 2001 From: juanjo <130799031+juanminguezsanz2023@users.noreply.github.com> Date: Sat, 11 Apr 2026 19:11:54 +0200 Subject: [PATCH 4/6] Update settings.py --- core/settings.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/settings.py b/core/settings.py index 7bd15e9..fb4f363 100644 --- a/core/settings.py +++ b/core/settings.py @@ -11,7 +11,14 @@ BASE_DIR = Path(__file__).resolve().parent.parent SECRET_KEY = os.getenv('SECRET_KEY', 'django-insecure-change-me-for-production') DEBUG = os.getenv('DEBUG', 'True').lower() == 'true' -ALLOWED_HOSTS = ['localhost', '127.0.0.1'] +ALLOWED_HOSTS = [ + 'v-encore-lab.com', + 'dev.v-encore-lab.com', + 'localhost', + '127.0.0.1', + 'django_app_dev', # Para que Nginx se hable con él por nombre + 'django_app_master' +] INSTALLED_APPS = [ 'django.contrib.admin', From ef42701a92e032e87de63b67047d2b95a48b2529 Mon Sep 17 00:00:00 2001 From: minguezsanzjuanjose Date: Sat, 11 Apr 2026 19:35:26 +0200 Subject: [PATCH 5/6] creacion de modelos --- apps/promociones/models.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 apps/promociones/models.py diff --git a/apps/promociones/models.py b/apps/promociones/models.py new file mode 100644 index 0000000..ea001fe --- /dev/null +++ b/apps/promociones/models.py @@ -0,0 +1,20 @@ +from django.db import models + +class Promocion(models.Model): + # Campos detectados en tu getData y setData + nombre = models.CharField(max_length=255) + fecha_inicio = models.DateField(null=True, blank=True) + fecha_modificacion = models.DateField(null=True, blank=True) + descripcion = models.TextField(null=True, blank=True) + activo = models.BooleanField(default=True) + + # Campo usado en tu JOIN de setData + categoria_id = models.IntegerField(null=True, blank=True) + + class Meta: + # ¡CRÍTICO! Esto le dice a Django que la tabla se llame exactamente + # como la has escrito en tu SQL manual + db_table = 'promociones' + + def __str__(self): + return self.nombre \ No newline at end of file From 199c0be297d032d5a459181c00ac76ea5a03f3bf Mon Sep 17 00:00:00 2001 From: minguezsanzjuanjose Date: Sat, 11 Apr 2026 19:41:58 +0200 Subject: [PATCH 6/6] actions y ip allowed en settings --- apps/promociones/actions.py | 2 +- core/settings.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/promociones/actions.py b/apps/promociones/actions.py index 5848372..919260d 100644 --- a/apps/promociones/actions.py +++ b/apps/promociones/actions.py @@ -16,7 +16,7 @@ def getData(params): # 2. Preparamos el diccionario de parámetros (tu estándar get_parameterized) # Limpiamos los datos antes de enviarlos a la base de datos id_promocion = clean_sql_int(params.get('id')) - is_active = 1 if params.get('activo') else 0 + is_active = True if params.get('activo') else False parameter_dict = [id_promocion, is_active] diff --git a/core/settings.py b/core/settings.py index fb4f363..9d07618 100644 --- a/core/settings.py +++ b/core/settings.py @@ -14,9 +14,10 @@ DEBUG = os.getenv('DEBUG', 'True').lower() == 'true' ALLOWED_HOSTS = [ 'v-encore-lab.com', 'dev.v-encore-lab.com', + '185.187.169.109', # Añade la IP aquí 'localhost', '127.0.0.1', - 'django_app_dev', # Para que Nginx se hable con él por nombre + 'django_app_dev', 'django_app_master' ]