Browse Source

Cambio la ubicación de la base de datos

politica
Celestino Rey 1 year ago
parent
commit
84dba33a98
8 changed files with 23 additions and 12 deletions
  1. +8
    -4
      Padel/.env.dev
  2. +2
    -2
      Padel/docker-compose.yml
  3. +3
    -0
      Padel/servicios/Dockerfile
  4. +1
    -1
      Padel/servicios/entrypoint.sh
  5. +3
    -2
      Padel/servicios/padel/__init__.py
  6. +3
    -3
      Padel/servicios/padel/reservas.py
  7. +2
    -0
      Padel/servicios/padel/templates/_navegacion.html
  8. +1
    -0
      SQLite/templates/list.html

+ 8
- 4
Padel/.env.dev View File

@ -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'

+ 2
- 2
Padel/docker-compose.yml View File

@ -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:
padel:

+ 3
- 0
Padel/servicios/Dockerfile View File

@ -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


+ 1
- 1
Padel/servicios/entrypoint.sh View File

@ -1,5 +1,5 @@
#!/bin/sh
python -m flask --app padel init-db
#python -m flask --app padel init-db
exec "$@"

+ 3
- 2
Padel/servicios/padel/__init__.py View File

@ -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

+ 3
- 3
Padel/servicios/padel/reservas.py View File

@ -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,),
)


+ 2
- 0
Padel/servicios/padel/templates/_navegacion.html View File

@ -46,6 +46,8 @@
</a>
<div class="navbar-dropdown">
<a href="{{ url_for('reservas.misreservas') }}" class="navbar-item">Mis reservas</a>
<a href="{{ url_for('auth.logout') }}" class="navbar-item">Salir</a>
</div>


+ 1
- 0
SQLite/templates/list.html View File

@ -17,6 +17,7 @@
<td> {{ row["city"]}}</td>
<td>{{row['pin']}}</td>
</tr>
{% endfor %}
</table>


Loading…
Cancel
Save