I want to retrieve json data and put it to database. I'm using django
When i post json i receive this error: Forbidden (403) CSRF verification failed. Request aborted.
Code
def receiver(request):
try:
json_data = request_to_json(request)
# Retrieving json data
x = json_data['x']
y = json_data['y']
z = json_data['z']
# put it in database
db = db_connection().db;
db_manager= db_management(db);
db_manager.insert_point(x,y,z,x);
db.close()
# A variable to return to the app
response = 'OK'
except:
response = 'Error'
return HttpResponse(simplejson.dumps(response))