diff --git a/JugarAlPadel/Dockerfile b/JugarAlPadel/Dockerfile index 511a6a2..ffbbb02 100644 --- a/JugarAlPadel/Dockerfile +++ b/JugarAlPadel/Dockerfile @@ -46,7 +46,7 @@ RUN mkdir -p $APP_HOME WORKDIR $APP_HOME # install system dependencies -RUN apt-get update && apt-get install -y sqlite3 netcat vim +RUN apt-get update && apt-get install -y sqlite3 netcat vim curl COPY --from=builder /app/wheels /wheels COPY --from=builder /app/requirements.txt . diff --git a/JugarAlPadel/K8S/Makefile b/JugarAlPadel/K8S/Makefile index c65e8b8..279ef3e 100644 --- a/JugarAlPadel/K8S/Makefile +++ b/JugarAlPadel/K8S/Makefile @@ -2,7 +2,7 @@ export ARQUITECTURA := $(shell lscpu |grep itectur | tr -d ' '| cut -f2 -d':') #export REGISTRY=localhost:5000 export REGISTRY=registry.reymota.es -export IMG_VERSION = 0.47 +export IMG_VERSION = 0.50 export IMG_NGINX_VERSION = 2.3 # limpia todo diff --git a/JugarAlPadel/K8S/env-prod-configmap.yaml b/JugarAlPadel/K8S/env-prod-configmap.yaml index 9777465..61712b8 100644 --- a/JugarAlPadel/K8S/env-prod-configmap.yaml +++ b/JugarAlPadel/K8S/env-prod-configmap.yaml @@ -2,8 +2,8 @@ apiVersion: v1 data: DEBUG: "False" ENTORNO: "Producción" - DJANGO_ALLOWED_HOSTS: "jugaralpadel.rancher.my.org jugaralpadel.es jugaralpadel.ddns.net vmcluster k8s-server localhost 127.0.0.1 [::1]" - CSRF_TRUSTED_ORIGINS: "http://jugaralpadel.rancher.my.org https://jugaralpadel.ddns.net https://jugaralpadel.es http://vmcluster" + DJANGO_ALLOWED_HOSTS: "jugaralpadel.rancher.reymota.lab jugaralpadel.es jugaralpadel.ddns.net vmcluster k8s-server localhost 127.0.0.1 [::1]" + CSRF_TRUSTED_ORIGINS: "http://jugaralpadel.rancher.reymota.lab https://jugaralpadel.ddns.net https://jugaralpadel.es http://vmcluster" SECRET_KEY: change_me SQL_DATABASE: jugaralpadel SQL_ENGINE: django.db.backends.postgresql diff --git a/JugarAlPadel/K8S/jugaralpadel-ingress.yaml b/JugarAlPadel/K8S/jugaralpadel-ingress.yaml index db6b338..de00442 100644 --- a/JugarAlPadel/K8S/jugaralpadel-ingress.yaml +++ b/JugarAlPadel/K8S/jugaralpadel-ingress.yaml @@ -26,6 +26,6 @@ spec: number: 1337 ingressClassName: nginx rules: - - host: jugaralpadel.rancher.my.org + - host: jugaralpadel.rancher.reymota.lab status: loadBalancer: {} diff --git a/JugarAlPadel/gestion_reservas/gestion_reservas/urls.py b/JugarAlPadel/gestion_reservas/gestion_reservas/urls.py index d1a4dac..672525a 100644 --- a/JugarAlPadel/gestion_reservas/gestion_reservas/urls.py +++ b/JugarAlPadel/gestion_reservas/gestion_reservas/urls.py @@ -27,6 +27,7 @@ urlpatterns = [ path('obreros/', admin.site.urls), path("eventos/", include('eventos.urls')), + path("usuarios/", include('reymotausers.urls')), path("accounts/", include("accounts.urls")), # new path("accounts/", include("django.contrib.auth.urls")), @@ -35,8 +36,5 @@ urlpatterns = [ path('entorno/', views.ver_variables_entorno, name='ver_variables_entorno'), path('ayuda/', views.ayuda, name='ayuda'), - path('api/proximo-evento/', views.proximo_evento, name='proximo_evento'), - path('api/todos-los-eventos/', views.todos_los_eventos, name='todos_los_eventos'), - ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/JugarAlPadel/gestion_reservas/gestion_reservas/views.py b/JugarAlPadel/gestion_reservas/gestion_reservas/views.py index 78bedd9..896b808 100644 --- a/JugarAlPadel/gestion_reservas/gestion_reservas/views.py +++ b/JugarAlPadel/gestion_reservas/gestion_reservas/views.py @@ -1,5 +1,4 @@ from rest_framework.response import Response -from rest_framework.decorators import api_view from django.utils import timezone from rest_framework import status @@ -52,53 +51,6 @@ def principal(request): return render(request, 'index.html', {'noticias': noticias}) -@api_view(['GET']) -def proximo_evento(request): - # Obtiene y valida el parámetro `publicado` - publicado_param = request.GET.get('publicado', 'true').lower() - if publicado_param not in ['true', 'false', 'all']: - return Response( - {'detail': 'El parámetro "publicado" debe ser "true", "false" o "all".'}, - status=status.HTTP_400_BAD_REQUEST - ) - - # Configura el filtro según el parámetro `publicado` - if publicado_param == 'all': - eventos = Evento.objects.filter(fecha__gte=timezone.now()).order_by('fecha') - else: - publicado = publicado_param == 'true' - eventos = Evento.objects.filter(publicado=publicado, fecha__gte=timezone.now()).order_by('fecha') - - evento = eventos.first() - - if evento: - serializer = EventoSerializer(evento) - return Response(serializer.data) - else: - return Response({'detail': 'No hay eventos próximos.'}, status=404) - - -@api_view(['GET']) -def todos_los_eventos(request): - # Obtiene y valida el parámetro `publicado` - publicado_param = request.GET.get('publicado', 'true').lower() - if publicado_param not in ['true', 'false', 'all']: - return Response( - {'detail': 'El parámetro "publicado" debe ser "true", "false" o "all".'}, - status=status.HTTP_400_BAD_REQUEST - ) - - # Configura el filtro según el parámetro `publicado` - if publicado_param == 'all': - eventos = Evento.objects.all().order_by('fecha') - else: - publicado = publicado_param == 'true' - eventos = Evento.objects.filter(publicado=publicado).order_by('fecha') - - serializer = EventoSerializer(eventos, many=True) # `many=True` para serializar una lista de eventos - return Response(serializer.data) - - def ayuda(request): elementos_ayuda = Ayuda.objects.all().order_by('apartado') apartados = Ayuda.APARTADOS diff --git a/ReyMotaAppsDj/K8S/env-prod-configmap.yaml b/ReyMotaAppsDj/K8S/env-prod-configmap.yaml index 9c573a0..4d3e7f3 100644 --- a/ReyMotaAppsDj/K8S/env-prod-configmap.yaml +++ b/ReyMotaAppsDj/K8S/env-prod-configmap.yaml @@ -2,8 +2,8 @@ apiVersion: v1 data: DEBUG: "False" ENTORNO: "Producción" - DJANGO_ALLOWED_HOSTS: "reymota.rancher.my.org reymota.es vmcluster k8s-server localhost 127.0.0.1 [::1]" - CSRF_TRUSTED_ORIGINS: "https://reymota.es http://vmcluster http://reymota.rancher.my.org/ http://localhost http://127.0.0.1" + DJANGO_ALLOWED_HOSTS: "reymota.rancher.reymota.lab reymota.es vmcluster k8s-server localhost 127.0.0.1 [::1]" + CSRF_TRUSTED_ORIGINS: "https://reymota.es http://vmcluster http://reymota.rancher.reymota.lab/ http://localhost http://127.0.0.1" SECRET_KEY: change_me SQL_DATABASE: reymota SQL_ENGINE: django.db.backends.postgresql diff --git a/ReyMotaAppsDj/K8S/reymota-ingress.yaml b/ReyMotaAppsDj/K8S/reymota-ingress.yaml index 99b929b..5e58ebd 100644 --- a/ReyMotaAppsDj/K8S/reymota-ingress.yaml +++ b/ReyMotaAppsDj/K8S/reymota-ingress.yaml @@ -26,6 +26,6 @@ spec: number: 1337 ingressClassName: nginx rules: - - host: reymota.rancher.my.org + - host: reymota.rancher.reymota.lab status: loadBalancer: {}