J
J
JRazor2015-01-03 22:29:56
Flask
JRazor, 2015-01-03 22:29:56

Flask: how to call one of the views without requests?

Hello toasters.

There are two views - one main, and the other will call on AJAX requests. But the first time you load the first view, you need to query the second one to get some information. Is it possible to somehow call the second view inside Flask without using requests.post (yes, there is only a POST request)?

The problem, in fact, is that for some reason it does not see the current user through requests.post. It is not safe to pass the user through AJAX on a crutch, and this is why this question arose.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Soshnikov, 2016-01-05
@soshnikov

Move the logic of the second view into a separate function and call it from both views.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question