【发布时间】:2015-10-27 19:19:15
【问题描述】:
我正在尝试构建一个应用程序,该应用程序具有一个页面,我在其中输入一个 id 并对其运行查询并显示结果。我到目前为止的代码如下。
我有一个 werkzeug 错误:
BuildError: ('show_entries', {}, None)
app.py
import cx_Oracle
# Run the query to display the results
@app.route('/matcher/<int:account_id>', methods=['GET', 'POST'])
def show_entries(account_id):
sql = """SELECT item1,
item2,
item3,
item4,
item5,
item6
FROM TABLE
WHERE account_id = ?"""
c = g.db.cursor()
c.execute(sql, account_id)
【问题讨论】:
-
确保访问请求变量?不确定您的 show_entries 是否按预期获取参数
-
可能是因为 show_entries 需要
url_for(show_entries)中的 account_id -
针对错误进行了编辑。表单操作实际上路由到“entry”方法,该方法应该重定向到“show_entries”并提供变量。
-
在入口路径中修改
return redirect(url_for('show_entries', account_id=account_id))是否有效?
标签: python sql oracle flask cx-oracle