@ -4,16 +4,18 @@ import mariadb
mydb = mariadb.connect(
host="",
user="",
password=""
password="",
database=""
)
print(mydb)
cursor = mydb.cursor()
app = Flask(__name__)
@app.get("/")
def show():
return render_template('show.html')
cursor.execute('SELECT * FROM items')
return render_template('show.html', cursor=cursor)
@app.post("/")
def create():
@ -7,8 +7,11 @@
</head>
<body>
<ul>
{%for (id, title, description, created_at, updated_at, parent_id) in cursor%}
<li>
{{title}}: {{description}}
</li>
{%endfor%}
</ul>
<form action="/" method="POST">
<input name="title" type="text">