From fb1257a0090e86b944d412724fd4cb503202ce09 Mon Sep 17 00:00:00 2001 From: Chris kerr Date: Sun, 11 Feb 2024 14:07:40 -0500 Subject: [PATCH] added basic html page for skill data --- app.py | 15 ++++++++++++++- templates/skills.html | 25 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 templates/skills.html diff --git a/app.py b/app.py index 351a2e2..267f7e1 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,5 @@ from flask import Flask, render_template, g, abort, request, jsonify, send_from_directory -import sqlite3, os +import sqlite3, os, csv from src.python.breed import get_breed_id, get_breeding_pairs, get_used_in_breeds @@ -222,5 +222,18 @@ def get_breeding_combinations(): used_in_breeds=used_in_breeds, ) +def read_csv(file_path): + data = [] + with open(file_path, 'r', newline='', encoding='utf-8') as csvfile: + reader = csv.DictReader(csvfile) + for row in reader: + data.append(row) + return data + +@app.route('/skills') +def skills(): + csv_data = read_csv('src/skills_data.csv') + return render_template('skills.html', csv_data=csv_data) + if __name__ == "__main__": app.run(debug=True) diff --git a/templates/skills.html b/templates/skills.html new file mode 100644 index 0000000..a776b46 --- /dev/null +++ b/templates/skills.html @@ -0,0 +1,25 @@ + + + + + + Skills Data + + +

Skills Data

+ + + {% for key in csv_data[0].keys() %} + + {% endfor %} + + {% for row in csv_data %} + + {% for value in row.values() %} + + {% endfor %} + + {% endfor %} +
{{ key }}
{{ value }}
+ +