@@ -16,7 +16,7 @@ def getData(params):
|
|||||||
# 2. Preparamos el diccionario de parámetros (tu estándar get_parameterized)
|
# 2. Preparamos el diccionario de parámetros (tu estándar get_parameterized)
|
||||||
# Limpiamos los datos antes de enviarlos a la base de datos
|
# Limpiamos los datos antes de enviarlos a la base de datos
|
||||||
id_promocion = clean_sql_int(params.get('id'))
|
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]
|
parameter_dict = [id_promocion, is_active]
|
||||||
|
|
||||||
|
|||||||
20
apps/promociones/models.py
Normal file
20
apps/promociones/models.py
Normal file
@@ -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
|
||||||
4
core/asgi.py
Normal file
4
core/asgi.py
Normal file
@@ -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()
|
||||||
@@ -11,7 +11,15 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||||||
SECRET_KEY = os.getenv('SECRET_KEY', 'django-insecure-change-me-for-production')
|
SECRET_KEY = os.getenv('SECRET_KEY', 'django-insecure-change-me-for-production')
|
||||||
DEBUG = os.getenv('DEBUG', 'True').lower() == 'true'
|
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 = [
|
INSTALLED_APPS = [
|
||||||
'django.contrib.admin',
|
'django.contrib.admin',
|
||||||
|
|||||||
7
core/wsgi.py
Normal file
7
core/wsgi.py
Normal file
@@ -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()
|
||||||
@@ -7,8 +7,14 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
- DEBUG=${DEBUG_MODE}
|
- DEBUG=${DEBUG_MODE}
|
||||||
# Usamos 'gitea-db-1' que es el nombre real y seguro
|
# Piezas sueltas para Django:
|
||||||
- DATABASE_URL=postgres://gitea:gitea_password@gitea-db-1:5432/gitea
|
- 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:
|
networks:
|
||||||
- gitea_net # Nombre interno para este archivo
|
- gitea_net # Nombre interno para este archivo
|
||||||
ports:
|
ports:
|
||||||
|
|||||||
Reference in New Issue
Block a user