import json
import datetime
+hostName = "localhost"
+serverPort = 8081
+
def build_page(eatable_rows, consumption_rows, eatables_selection, day_rows):
return """<html>
<meta charset="UTF-8">
"<td>%.1f</td>"\
"</tr>" % (db.eatables_selection(c.eatable_key), c.unit_count, r["cals"], r["sugar"])
day_rows = ""
- for date, day in db.days.items():
+ for date in sorted(db.days.keys()):
+ day = db.days[date]
day_rows = "<tr>"\
"<td><input name=\"day_date\" type=\"hidden\" value=\"%s\" />%s</td>"\
"<td><input name=\"day_cals\" type=\"hidden\" step=\"0.1\" min=\"0\" value=\"%.1f\" />%.1f</td>"\
self.wfile.write(bytes(page, "utf-8"))
-hostName = "localhost"
-serverPort = 8081
if __name__ == "__main__":
webServer = HTTPServer((hostName, serverPort), MyServer)
- print("Server started http://%s:%s" % (hostName, serverPort))
+ print(f"Server started http://{hostName}:{serverPort}")
try:
webServer.serve_forever()
except KeyboardInterrupt:
if __name__ == "__main__":
webServer = HTTPServer((hostName, serverPort), MyServer)
- print("Server started http://%s:%s" % (hostName, serverPort))
+ print(f"Server started http://{hostName}:{serverPort}")
try:
webServer.serve_forever()
except KeyboardInterrupt: