我有一个非常简单的查询(刚从SQLAlchemy开始),我知道它是有效的,因为它在终端中打印,而不是在HTML页面上打印,这就是问题所在。在
具体如下:
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import *
from models import db, Candidate, User, Template
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
some_engine = create_engine('databse_url')
Session = sessionmaker(bind=some_engine)
session = Session()
@application.route("/", methods=['GET', 'POST'])
def index():
res = session.query(Template).all()
for temp in res:
print temp.spark_id
return render_template('index.html')
在终端中,2个“spark iu id”被打印出来,但是在HTML页面上我什么也没有得到。在
在索引.html第1页:
^{pr2}$出什么问题了?在
您没有将查询结果传递到模板:
相关问题 更多 >
编程相关推荐