I modify the login of flaskr sample app, the first line get error. But http://www.html is in the template dir.
return redirect(url_for('www'))
#return redirect(url_for('show_entries'))
display error:
werkzeug.routing.BuildError
BuildError: ('www', {}, None)
return redirect(url_for('www'))would work if you have a function somewhere else like this:url_forlooks for a function, you pass it the name of the function you are wanting to call. Think of it like this:You could also do
return redirect('/some-url'), if that is easier to remember. It is also possible that what you want, given your first line, is justreturn render_template('www.html').And also, not from shuaiyuancn’s comment below, if you are using blueprints,
url_forshould be invoked asurl_for('blueprint_name.func_name')Note you aren’t passing the object, rather the string. See documentation here.