我制作了一个烧瓶脚本,该脚本运行良好,但是我试图在另一个html页面上的表中显示某些值,但由于某种原因而没有发生。
我已经尝试过jinja2文档和其他一些答案,但是并没有太大帮助。
flask文件。py
from flask import flask,render_template,request
app = flask(__name__)
from webscraper import keeda,display_tbl
@app.route('/',methods=['POST','GET'])
def scraper():
if request.method == 'POST':
url = request.form['url']
df=keeda(url)
return render_template(('completed.html',display_tbl(df)))
else:
return render_template('index.html')
if __name__ == '__main__':
app.run()
the completed.html file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Summary of Scraped Data</title>
</head>
<body>
<h1>This is what you got! </h1>
<div>
{{ display_tbl(df) }}
</div>
</body>
</html>
here's the error: jinja2.exceptions.UndefinedError: 'display_tbl' is undefined
i wanted to display a table with values on this page.