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/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 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/settings.py b/core/settings.py index 7bd15e9..9d07618 100644 --- a/core/settings.py +++ b/core/settings.py @@ -11,7 +11,15 @@ 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', + '185.187.169.109', # Añade la IP aquí + 'localhost', + '127.0.0.1', + 'django_app_dev', + 'django_app_master' +] INSTALLED_APPS = [ 'django.contrib.admin', 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 diff --git a/deployments/docker-compose.yml b/deployments/docker-compose.yml index cfc8f56..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_password@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: