So I have implemented this code:
from flask import Flask, render_template,redirect,url_for
from flask.globals import request
from task2_code import predict_num_new_cases as p
app=Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/Task1')
def Task1():
return render_template('Task 1.html')
@app.route('/Task2', methods=['GET','POST'])
def Task2():
render_template('Task 2.html')
if request.method=='POST' or request.method=='GET':
nvax=request.form.get('nvax')
po=request.form.get('pop')
co=request.form.get('c')
return redirect(url_for('display',novax=nvax,pop=po,country=co))
else:
return render_template('Task 2.html')
@app.route('/pdfview1')
def pdffor1():
return render_template
@app.route('/Task 2/display')
def display(novax,pop,country):
predicted=p(novax,pop,country)
return render_template('display.html',predicted)
@app.route('/bibliography')
def bibliography():
render_template('bibliography.html')
'''def functionultimate(no_cases,population):
#calculate stuff
return #a string value that can be concatenated into task 2'''
if __name__=="__main__":
app.run(debug=True)
but it raises the following error:
TypeError: display() missing 3 required positional arguments: 'novax', 'pop', and 'country'
My goal is to pass in arguments into the display function such that it invokes another function from task2_code and displays the result in display.html How else do I pass in arguments for the display function?