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)