You have to pass a variable to your template, which jinja then uses to fill in the extracted information. Since templateData is a dict, there is no need to pass it as **kwargs. Jinja doesn't work well with kwargs anyway[/code]Code:
templateData = { 'title' : 'GPIO output Status!', 'ledRed' : ledRedSts, 'temperature' : tempSts, } [code]return render_template('index2.html', **templateData)
Code:
templateData = { 'title' : 'GPIO output Status!', 'ledRed' : ledRedSts, 'temperature' : tempSts, } return render_template('index2.html', data = templateData){{ data['title'] }}
{{ data['ledRed'] }}
{{ data['temperature'] }}
Note that I changed the variable on purpose to show which one is used in the template. You often see the following to keep the same variable names:
Code:
return render_template('index2.html', templateData = templateData)Statistics: Posted by kheylen25 — Sun Mar 03, 2024 8:50 am