Call a route from within another route in Flask [duplicate] Call a route from within another route in Flask [duplicate] flask flask

Call a route from within another route in Flask [duplicate]


Yes, this is the wrong approach. Generally with web frameworks it's best to think of a route as serving up the whole of a page. But that's not to say that you can't call multiple functions from within that route handler. So in your case I would recommend moving your json code into its own function, which you can call from both routes if you need to.