You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
460 B
26 lines
460 B
from flask import Flask, render_template, request
|
|
import mariadb
|
|
|
|
mydb = mariadb.connect(
|
|
host="",
|
|
user="",
|
|
password="",
|
|
database=""
|
|
)
|
|
|
|
cursor = mydb.cursor()
|
|
|
|
app = Flask(__name__)
|
|
|
|
@app.get("/")
|
|
def show():
|
|
cursor.execute('SELECT * FROM items')
|
|
return render_template('show.html', cursor=cursor)
|
|
|
|
@app.post("/")
|
|
def create():
|
|
return {
|
|
'title':request.form['title'],
|
|
'description':request.form['description']
|
|
}
|