当我试图在我的帐户页面上添加一个成分时,我得到了下面的错误(它只包括表单AddToPantry-one字段,component\u name)。在
sqlalchemy.exc.OperationalError
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) table ingredient has no column named user_id [SQL: 'INSERT INTO ingredient (ingredient_name, user_id) VALUES (?, ?)'] [parameters: ('bread', 1)] (Background on this error at: http://sqlalche.me/e/e3q8)
以下是我的模型:
^{pr2}$“我的帐户”的“路由”正在加载,该页面的位置是:
@app.route("/account", methods=['GET', 'POST'])
@login_required
def account():
form = AddToPantry()
if form.validate_on_submit():
ingredient = Ingredient(ingredient_name=form.ingredient_name.data, user=current_user)
db.session.add(ingredient)
db.session.commit()
return render_template('account.html', title='Account', form=form)
我有旧的pycache数据。一旦我删除了这个文件夹,删除了我的表并重新创建了它们,问题就解决了。在
相关问题 更多 >
编程相关推荐