added basic html page for skill data
This commit is contained in:
parent
4b8f92fe95
commit
fb1257a009
15
app.py
15
app.py
@ -1,5 +1,5 @@
|
|||||||
from flask import Flask, render_template, g, abort, request, jsonify, send_from_directory
|
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
|
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,
|
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__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=True)
|
app.run(debug=True)
|
||||||
|
25
templates/skills.html
Normal file
25
templates/skills.html
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>Skills Data</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Skills Data</h1>
|
||||||
|
<table border="1">
|
||||||
|
<tr>
|
||||||
|
{% for key in csv_data[0].keys() %}
|
||||||
|
<th>{{ key }}</th>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% for row in csv_data %}
|
||||||
|
<tr>
|
||||||
|
{% for value in row.values() %}
|
||||||
|
<td>{{ value }}</td>
|
||||||
|
{% endfor %}
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user