return redirect(url_for('www')) will work if you have a function somewhere else, for example:
@app.route('/welcome') def www(): return render_template('www.html')
url_for looking for a function, you pass it the name of the function you want to call. Think of it this way:
@app.route('/login') def sign_in(): for thing in login_routine: do_stuff(thing) return render_template('sign_in.html') @app.route('/new-member') def welcome_page(): flash('welcome to our new members') flash('no cussing, no biting, nothing stronger than gin before breakfast') return redirect(url_for('sign_in'))
You can also do return redirect('/some-url') if that is easier to remember. It is also possible that you want, given your first line, just return render_template('www.html') .
And also, not from the shuaiyuancn comment below, if you are using drawings, url_for should be called as url_for('blueprint_name.func_name') Note that you are not passing an object, but rather a string. See the documentation here .
unmounted Sep 10 '10 at 9:31 2010-09-10 09:31
source share