How do I add or subtract 1 from the variable num ( in flask route) with an HTML button?
So when I click the button it change the var to 1 and refresh the page to show the new value
@app.route('/')
def note():num = 1return render_template('home.html', num=num)
app.py
from flask import Flask, render_template, request, sessionapp = Flask(__name__)app.secret_key = 'BAD_SECRET_KEY'@app.route('/')
def home():if session['num'] > 0:session['num'] = session['num']
else:session['num'] = 0if request.method == 'GET':session['num'] += 1 num = session['num']return render_template('home.html', num=num)
home.html
<form><input type="submit" name="count_button" value="count">
</form><h1>The count is: {{num}}</h1>