【发布时间】:2022-08-08 01:26:08
【问题描述】:
我有我的server.py 文件,其中有:
from flask import Flask,render_template,url_for
app=Flask(__name__)
@app.route(\"/\")
@app.route(\"/home\")
def home():
return render_template(\"home.html\",posts=posts,title=\"arroz\")
if __name__==\"__main__\":
app.run(debug=False)
我的home.html 文件有:
{%extends \"layout.html\"%}
{%block content%}
<!--here-->
{%endblock content%}
我想在 python 文件中执行一些 python 代码客户在 home.html 文件的评论 here 中。我不能只从烧瓶中调用常规的 python 代码,因为它会在服务器端运行。如何在客户端运行它?
我的项目结构如下:
|-server.py
|-pythonToExecuteOnClientSide.py
|-templates
|-home.html