Python Forum
display multiple sensors on webpage python flask jinja
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
display multiple sensors on webpage python flask jinja
#5
SOLVED!!!
Thank you guys! I have solved it. Heres my code for sensors.py
@bp.route('/sensors')
@login_required
def sensors():
    return render_template('sensors/sensors.html',
                          sensorsID=sensorsID, read_sensor=read_sensor)
and here is my code for sensors.html
{%block content %}
    <h1>Sensors temperature list</h1>
      <table>
        {% for i in sensorsID %}
          <tr>
            <th> Sensor {{ sensorsID[i]['name'] }}</th>
            <td> temperature is {{ read_sensor(sensorsID[i]['ID']) }} </td>
          </tr>
        {% endfor %}
      </table>
{% endblock %}
this gives this (well I would have put a screen shot here but I cant work out how to do it!)
My warmest regards to stullis and snippsat
Reply


Messages In This Thread
RE: display multiple sensors on webpage python flask jinja - by pascale - Jan-28-2019, 09:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Solved] Browser won't parse text from yaml loaded into Jinja SpongeB0B 1 1,123 Jul-07-2022, 09:37 PM
Last Post: SpongeB0B
Question Accessing a value of a dictionary with jinja.... SpongeB0B 2 11,159 Aug-06-2021, 09:05 AM
Last Post: ndc85430
  Help using Flask for a countdown on webpage ZenBuddhism 1 2,376 Feb-05-2021, 03:35 PM
Last Post: snippsat
  Using range slider in flask webpage to use in python KimPet 2 7,979 Jan-23-2021, 11:58 PM
Last Post: snippsat
  Flask, Display a picture outisde the static SpongeB0B 6 16,417 Aug-29-2020, 05:15 PM
Last Post: nilamo
  python 3.7 on windows using flask and flask-sqlalchemy. Alpy 2 4,145 Aug-12-2020, 07:24 PM
Last Post: Alpy
  How to display XML tree structure with Python? sonicblind 13 42,859 Aug-12-2020, 02:05 PM
Last Post: mreshko
  Jinja sort values from request.form SpongeB0B 2 2,378 Jul-26-2020, 07:41 AM
Last Post: SpongeB0B
  how to create dynamic arguments to be passed in jinja template in url_for function? experimental 1 2,925 May-01-2020, 05:50 PM
Last Post: Larz60+
  Python values on a WebPage Petrouil 1 2,022 Apr-01-2020, 05:08 PM
Last Post: ndc85430

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020