create a db (not fully finish)

This commit is contained in:
Rainy21
2026-02-20 22:46:33 -05:00
parent c30b088af4
commit 787f3458b4
5 changed files with 141 additions and 8 deletions
+27
View File
@@ -0,0 +1,27 @@
from flask import Flask , render_template
import sqlite3
app = Flask(__name__)
def get_db_connect():
conn = sqlite3.connection("./db/my_library.db")
conn.row_factory = sqlite3.Row
return conn
@app.route('/')
def index():
conn = sqlite3.connection("./db/my_library.db")
query = """
SELECT m.title, m.type, m.release_year, m.rating,
b.author, s.network
FROM media m
LEFT JOIN books b on m.id = b.books_id
LEFT JOIN shows s on m.id = s.shows_id
"""
items = conn.execute(query).fetchall()
conn.close()
if __name__ == '__main__':
app.run(debug = True)