From e3c07bff612c84e65bf5e62cae5e4e6b50cb0043 Mon Sep 17 00:00:00 2001 From: Yinglong Fang <fangy25@cardiff.ac.uk> Date: Wed, 10 Jan 2024 09:37:46 +0000 Subject: [PATCH] Upload New File --- app.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 app.py diff --git a/app.py b/app.py new file mode 100644 index 0000000..a1f8f24 --- /dev/null +++ b/app.py @@ -0,0 +1,42 @@ +from flask import Flask, render_template, Blueprint, redirect, url_for, request +import sqlite3 + +app = Flask(__name__, template_folder='templates') + +@app.route("/") +@app.route("/home") +def home(): + return render_template('index.html') + +def get_db_connection(): + conn = sqlite3.connect('database.db') + conn.row_factory = sqlite3.Row + return conn + +@app.route("/skill") +def skill(): + conn = get_db_connection() + cur = conn.cursor() + cur.execute('SELECT * FROM skill') + skills = cur.fetchall() + return render_template('skill.html', skills=skills) + +@app.route("/project") +def project(): + return render_template('project.html') + +@app.route("/education") +def education(): + conn = get_db_connection() + cur = conn.cursor() + cur.execute('SELECT * FROM education') + educations = cur.fetchall() + return render_template('education.html', educations=educations) + + +@app.route("/contact") +def contact(): + return render_template('contact.html') + +if __name__ == '__main__': + app.run(debug=False) \ No newline at end of file -- GitLab