how to get the previous url in flask [duplicate]

2019-06-26 09:06发布

问题:

This question already has an answer here:

  • Redirect back in Flask 1 answer

I am using flask to do some user interaction. Basically, when the user clicks a button on page A or B, it goes to url C to get some data which does not have a visualization. After getting the data, I want to go back to the original page (A or B). How shall I find out where the user came from?

回答1:

I think what you need is request.referrer. There are some examples here