Issue
When you are within an @app.route in Flask, can you return a value for your function in addition to returning render_template?
Solution
No, it's not possible to do so directly - return value of function decorated with @app.route
is automatically passed back by Flask as a page to the client (render_template return value is actually a HTML string representing the page), and the control flow is such that you can't simply "pass" arguments to a different @app.route
. What you can do though, is store whatever you need in a global variable than can be accessed by different functions.
Answered By - matszwecja
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.