[Django]-RawPostDataException: You cannot access body after reading from request's data stream

7👍

This is occuring is because you are trying to access the data from body

use -> data = json.loads(request.data)

3👍

Use request.data instead of request.body.

request.data does not read the data stream again.

0👍

hey thanks for the response but I figured it out! It wasn’t working because I found a small bug where I am able to access the login page even though I am already logged in, so the error was caused by trying to login again. I fixed the issue by redirecting to home page if login page is tried to be reached

Leave a comment