Search code examples
pythonhttp-redirectflaskweb-frameworksforward

Flask 'in app' redirect aka forward


Is it possible to do 'in app' redirect in Flask app like in old poor Symfony 1? I mean if during of processing one request I decide to change my view function (by some condition) and I don't want to do real redirect can I call something like forward(*other_view_name*)?


Solution

  • Copy of Martijn Pieters' answer in the comment section:

    Why don't you try it? Views are just functions, so just do

    return name_of_other_view_function()