0

I have a simple python function inside my Django app's views.py:

def some_function(requests):
return redirect('some_url')

The redirect returns some useful information that I want to use later in the other function. Is there any way I can store the response URL given by the redirect in a variable so that I can use it later in my app. Thanks

  • 1
    You should not store such things. A webserver should be *stateless*, so you do not store items in memory except for the database and the file system. Doing so would make the system unscalable and error-prone. – Willem Van Onsem Feb 19 '21 at 11:39
  • Hi @WillemVanOnsem , It's just for testing purpose and not for any real production app, thanks. – Sanju Gautam Feb 19 '21 at 11:43
  • I would consider that even more horrifying. :) – Willem Van Onsem Feb 19 '21 at 11:47
  • It's not that I want to store, it's just a chain of APIs where I am hitting the second API with the response received from the first URL :) Nothing horrifying I guess. – Sanju Gautam Feb 19 '21 at 11:49

0 Answers0