old_contents: from bottle import route, run, template, static_file, response, request
  from json import dumps
  import os
  
  BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  STATIC_PATH = os.path.join(BASE_DIR,'assets')
  
  @route('/assets/:path#.+#', name='assets')
  def static(path):
      return static_file(path, root=STATIC_PATH)
  
  @route('/')
  def index():
      return template('hello')
  
  
  
  @route('/medidas')
  def medidas():
  	rv = [{ "temp": 1, "lux": 2}]
  	response.content_type = 'application/json'
  	return dumps(rv)
  
  
  @route('/comandos', method='POST')
  def comandos():
  	com = request.forms.get('comando')
  	print com
  	return "Success"
  
  
  run(host='localhost', port=8080, debug=True)
new_contents: from bottle import route, run, template, static_file, response, request
  from json import dumps
  import serial
  import time
  
  ser = serial.Serial('COM3', 9600, timeout=0)
  ser.readlines()
  
  
  @route('/assets/:path#.+#', name='assets')
  def static(path):
      return static_file(path, root='assets')
  
  @route('/')
  def index():
      return template('hello')
  
  
  
  @route('/medidas')
  def medidas():
      ser.write('M')
      time.sleep(0.5)
      medidas = ser.readline()
      medidas = medidas.split()
      rv = [{ "temp": medidas[2], "lux": medidas[5]}]
      response.content_type = 'application/json'
      return dumps(rv)
  
  
  @route('/comandos', method='POST')
  def comandos():
      comando = request.forms.get('comando')
      ser.write(comando)
      return "Success"
  
  
  run(host='localhost', port=8080, debug=True)
  
subject: Add serial code