【发布时间】:2014-11-13 04:45:45
【问题描述】:
我想在发生异常时重定向到带有错误代码的注册页面。我怎么能在烧瓶中做到这一点?如何使用错误代码重定向到同一页面?
@app.route('/signup', methods=['GET','POST'])
def signup():
error = None
if request.method == 'POST':
try:
... my code ...
except Exception, e:
error = "hey this is error"
... i want to redirect to signup with error ...
... i get only some stacktrace page due to debug ...
return redirect(url_for('login'))
return render_template('signup.html', error=error)
【问题讨论】:
标签: python exception web flask