I have a view that is defined like such:
@views.route('/issues')
def show_view():
action = request.args.get('action')
method = getattr(process_routes, action)
return method(request.args)
in my process_routes module, I would like to call this method, and pass query string values. I have the following code:
return redirect(url_for('views.show_view', action='create_or_update_success'))
I have a function in process_routes named create_or_update_success
I am getting
BuildError: ('views.show_view', {'action': 'create_or_update_success'}, None)
views is a blueprint. I can successfully call
/issues?action=create_or_update_success
In my browser.
What am I doing wrong?
url_for()cannot find theviews.show_viewregistration. Are you sure yourviewsBlueprint uses the nameviewswhen registered with yourFlaskobject?viewsperhaps yourFlaskobject itself?views = Blueprint(__name__, __name__). The app object is namedapp__name__is the name of the current module, so yourBlueprintobject is probably not namedviews.views.pyis a module in a package, in which case__name__will contain the full path. Don't use__name__as the first argument, give it a string literal instead so you can be sure of its value.