Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.09 KB | None | 0 0
  1. # Script de servidor para el Wall-screen de WallboxOK
  2.  
  3. from flask import Flask
  4. from flask import render_template
  5. # Librerias para buscar el fichero del cargador
  6. import time
  7. import os.path as path
  8. import os
  9.  
  10. app = Flask(__name__)
  11.  
  12. @app.route('/')
  13. def hello_world():
  14.     return render_template('index.html')
  15.  
  16. @app.route('/info.html')
  17. def info():
  18.     # TODO: Probar para ver si los detecta todo el rato
  19.     # o hay que hacer una funcion asincrona
  20.  
  21.     # Rutas del fichero
  22.     coche_uno = path.isfile("../chargebox/txt/idTransac0.txt")
  23.     coche_dos = path.isfile("../chargebox/txt/idTransac1.txt")
  24.     #TODO: Probar a hacer un diccionario
  25.     dos=False
  26.     izquierda=False
  27.     derecha=False
  28.     ninguno = False
  29.  
  30.     if coche_uno and coche_dos:
  31.         dos = True
  32.  
  33.     elif coche_uno:
  34.         izquierda = True
  35.  
  36.     elif coche_dos:
  37.         derecha = False
  38.  
  39.     else:
  40.         ninguno = True
  41.    
  42.     # TODO: Pruebas con el numero de coches en local
  43.     # CAMBIAR!!!
  44.     return render_template('cargando.html')
  45.  
  46.  
  47. if __name__ == "__main__":
  48.     app.run(port=5000, debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement