R
R
Rodion Yurchenko2015-11-20 13:22:56
Django
Rodion Yurchenko, 2015-11-20 13:22:56

How to accept POST from another site in DJANGO?

Good afternoon !
I bind w1 to the site
I don’t know how to solve the problem with CSRF
When sending data to W1, the usual form is used, WITHOUT a CSRF token, since the form will send data directly to W1
W1 processes everything, everything goes fine and at the last stage of payment W1 responds again with POST data to my site
And then my site crashes with an error that there is no CSRF token
It naturally should not exist, w1 answers ...
How to get out of this situation?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey, 2015-11-20
@MAKAPOH

You can disable csrf checks specifically for this view. There is a csrf_exempt decorator for this.

S
skorpix, 2015-11-20
@skorpix

It is possible like this:

@method_decorator(csrf_exempt)
    def dispatch(self, *args, **kwargs):
        return super(<ViewName>, self).dispatch(*args, **kwargs)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question