1
我想在出现异常时重定向到带有错误代码的注册页面。我如何在烧瓶中做到这一点?我如何重定向到错误代码的同一页面?Python烧瓶重定向错误
@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)