我无法在页面上显示输出。我试过使用 app.send_static_file()
有什么,我在代码或 HTML 页面中丢失了..?
我已经稍微更新了代码并使用 HTTP 工具包检查了响应是一个 HTML 文件,但它没有显示在页面上。
Python
@app.route("/", methods=['GET','POST'])
def main_page():
if request.method == "POST":
submitted = request.form.to_dict()
print(submitted)
if submitted["authorizationcode"] == "RandomNO":
if len(submitted["ktownurl"]) >0:
print("Not Null")
else:
price = submitted["price"]
price = float(price)
productype = submitted["producttype"]
bulorder = submitted["bulkorder"]
calc_prices = calculator(price,bulorder,productype)
calculated = calc_prices.split(":")
minretail = calculated[0]
maxretail = calculated[1]
return(render_template("index.html", minretail=minretail, maxretail = maxretail))
else:
return(render_template("index.html"))
if __name__ == '__main__':
app.run(host='0.0.0.0', port=80)
HTML
<section class="u-clearfix u-valign-middle u-section-2" id="sec-fb20">
<div class="u-clearfix u-expanded-width u-layout-wrap u-palette-5-dark-2 u-layout-wrap-1">
<div class="u-layout">
<div class="u-layout-row">
<div class="u-container-style u-layout-cell u-size-30 u-layout-cell-1">
<div class="u-container-layout u-container-layout-1">
<h3 class="u-align-center u-text u-text-1">Minimum Price</h3>
<div class="u-container-style u-group u-palette-1-base u-radius-15 u-shape-round u-group-1">
<div class="u-container-layout u-container-layout-2">
<h4 class="u-align-center u-text u-text-default u-text-2">{{minretail}}</h4>