# Example to demonstrate two ways to send values from the browser to the web # server, which can pass them on to the hardware. from flask import Flask, render_template, request app = Flask(__name__) # Main page @app.route('/') def index(): return render_template('sendvalues.html') # URL-based @app.route('/set/') def setTemp(temp): return render_template('showvalues.html', recipe="a preprogrammed recipe", targetTemp=temp) # POST-based @app.route('/cook', methods=['GET', 'POST']) def cook(): if request.method == 'POST': recipe = request.form['name'] temp = request.form['temperature'] return render_template('showvalues.html', recipe=recipe, targetTemp=temp) else: return("This is what you GET")