I have a currently running app here that passes a dictionary from my main python file to a table in my html file, and it works. I am trying to pass a second dictionary to the same html file to display in a second table, but I get errors in my log that I can't figure out. If I try to pass the second dictionary by itself, everything works. I feel like I am missing something obvious or making a dumb newbie error.
This is the end of my main function in my python file passing the 2 dictionaries:
return weeklyPointsDict, sortedTotalsDict
# print('Week number: ', week)
main()
This is the flaskApp.py
# flask app to launch scoreboard
from flask import Flask, render_template
import harknessScoreboard
#import testDict
app = Flask(__name__)
app.config["DEBUG"] = True
@app.route("/")
#@app.route("/scoreboard")
def scoreboard():
weeklyPointsDict = harknessScoreboard.main()
sortedTotalsDict = harknessScoreboard.main()
#weeklyPointsDict = testDict.main()
#weeklyPointsDict = {"Julian": 25, "Bob": 26, "Dan": 47, "Cornelius": 3}
return render_template("scoreboard.html", weeklyPointsDict=weeklyPointsDict, sortedTotalsDict=sortedTotalsDict)
#print(weeklyPointsDict)
#scoreboard()
And here is my template html
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='style.css') }}">
<title>Harkness Scoreboard</title>
</head>
<body>
<img src="/static/images/HarknessLogo.svg" alt="Harkness Logo" style="max-width:25%;height:auto;">
<h2 style="margin-bottom: 0">Harkness Scoreboard</h2>
<h4 style="margin-top: 0">Alpha v0.1</h4>
<table class="centered thick-border">
<tr>
<th>Player</th>
<th>Weekly Points</th>
</tr>
{% for k, v in weeklyPointsDict.items() %}
<tr>
<td>{{ k }}</td>
<td>{{ v }}</td>
</tr>
{% endfor %}
</table>
<table class="centered thick-border">
<tr>
<th>Player</th>
<th>Total Points</th>
</tr>
{% for k, v in sortedTotalsDict.items() %}
<tr>
<td>{{ k }}</td>
<td>{{ v }}</td>
</tr>
{% endfor %}
</table>
<p>For entertainment only. See sheet for official scores. No wagering please.</p>
</body>
</html>
Any insight would be helpful.