From 84dba33a98c884b4526ab9cf3cd6122ca96dcba5 Mon Sep 17 00:00:00 2001 From: Celestino Rey Date: Fri, 17 May 2024 10:17:47 +0200 Subject: [PATCH] =?UTF-8?q?Cambio=20la=20ubicaci=C3=B3n=20de=20la=20base?= =?UTF-8?q?=20de=20datos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Padel/.env.dev | 12 ++++++++---- Padel/docker-compose.yml | 4 ++-- Padel/servicios/Dockerfile | 3 +++ Padel/servicios/entrypoint.sh | 2 +- Padel/servicios/padel/__init__.py | 5 +++-- Padel/servicios/padel/reservas.py | 6 +++--- Padel/servicios/padel/templates/_navegacion.html | 2 ++ SQLite/templates/list.html | 1 + 8 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Padel/.env.dev b/Padel/.env.dev index e7a10c6..c94dd11 100644 --- a/Padel/.env.dev +++ b/Padel/.env.dev @@ -1,11 +1,15 @@ ENVIRONMENT="Development" FLASK_SECRET_KEY=29d3e20c7048a9d5df4f632fce4c0969fdac4e7f5334afff3ec869789a73a5d5 -FLASK_DATABASE=padel.sqlite +FLASK_DATABASE=instance/padel.sqlite MAIL_SERVER= 'smtp.mail.yahoo.com' -MAIL_PORT = 465 -MAIL_USERNAME = 'celestino_rey@ymail.com' -MAIL_PASSWORD = 'kbryvwxkockqckss' +MAIL_PORT = 587 +#MAIL_USERNAME = 'celestino_rey@ymail.com' +#MAIL_PASSWORD = 'kbryvwxkockqckss' +MAIL_USERNAME = 'devesapark@yahoo.com' +MAIL_PASSWORD = 'xUp7bax8knAVwi' + MAIL_USE_TLS = 'False' MAIL_USE_SSL = 'True' +ENVIA_MAIL = 'True' \ No newline at end of file diff --git a/Padel/docker-compose.yml b/Padel/docker-compose.yml index beae44e..dead8d5 100644 --- a/Padel/docker-compose.yml +++ b/Padel/docker-compose.yml @@ -5,11 +5,11 @@ services: build: ./servicios command: python3 -m flask --app padel run -h 0.0.0.0 volumes: - - ./padel:/usr/src/padel/ + - ./instance:/padel/instance ports: - 5001:5000 env_file: - ./.env.dev volumes: - postgres_data: \ No newline at end of file + padel: \ No newline at end of file diff --git a/Padel/servicios/Dockerfile b/Padel/servicios/Dockerfile index bc36ec3..2d2e360 100644 --- a/Padel/servicios/Dockerfile +++ b/Padel/servicios/Dockerfile @@ -8,6 +8,9 @@ WORKDIR /padel ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 +# install system dependencies +RUN apt-get update && apt-get install -y sqlite3 + COPY requirements.txt requirements.txt RUN pip3 install -r requirements.txt diff --git a/Padel/servicios/entrypoint.sh b/Padel/servicios/entrypoint.sh index badf05f..109ad49 100755 --- a/Padel/servicios/entrypoint.sh +++ b/Padel/servicios/entrypoint.sh @@ -1,5 +1,5 @@ #!/bin/sh -python -m flask --app padel init-db +#python -m flask --app padel init-db exec "$@" \ No newline at end of file diff --git a/Padel/servicios/padel/__init__.py b/Padel/servicios/padel/__init__.py index 633ac62..98fbf81 100644 --- a/Padel/servicios/padel/__init__.py +++ b/Padel/servicios/padel/__init__.py @@ -47,9 +47,10 @@ def create_app(): print(f"Current Environment: {os.getenv('ENVIRONMENT')}") print(f"Using Database: {app.config.get('DATABASE')}") - my_env = os.getenv("ENVIA_EMAIL", 'False').lower() in ('true', '1', 't') + print("MAIL_USERNAME: ", os.getenv("MAIL_USERNAME")) + my_env = os.getenv("ENVIA_MAIL", 'False').lower() in ('true', '1', 't') - print(f"Sending emails: ", my_env) + print(f"Enviar emails: ", my_env) return app diff --git a/Padel/servicios/padel/reservas.py b/Padel/servicios/padel/reservas.py index 9e83f6f..f79afa3 100644 --- a/Padel/servicios/padel/reservas.py +++ b/Padel/servicios/padel/reservas.py @@ -78,9 +78,9 @@ def actualizar_reserva(id): ) db.commit() - enviar_correos = os.getenv("ENVIA_EMAIL", 'False').lower() in ('true', '1', 't') + enviar_correos = os.getenv("ENVIA_MAIL", 'False').lower() in ('true', '1', 't') - # print(f"Sending emails: ", my_env) + print(f"Sending emails: ", enviar_correos) if enviar_correos == True: msg = Message('Reserva de pista de padel confirmada', sender='celestino_rey@ymail.com', recipients=[current_user.email]) @@ -145,7 +145,7 @@ def eligedia(): db = get_db() for hora in range(8,18): - print("hora: %2d", hora) + print("hora: %02d" % hora) db.execute( "INSERT INTO reservas (nombre, fecha, hora) VALUES (?, ?, ?)", ("-", diaelegido, "%02d:00" % hora,), ) diff --git a/Padel/servicios/padel/templates/_navegacion.html b/Padel/servicios/padel/templates/_navegacion.html index 16c26de..d49e766 100644 --- a/Padel/servicios/padel/templates/_navegacion.html +++ b/Padel/servicios/padel/templates/_navegacion.html @@ -46,6 +46,8 @@ diff --git a/SQLite/templates/list.html b/SQLite/templates/list.html index a888233..d6bd63a 100644 --- a/SQLite/templates/list.html +++ b/SQLite/templates/list.html @@ -17,6 +17,7 @@ {{ row["city"]}} {{row['pin']}} + {% endfor %}