Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » [django] error CSRF token missing or incorrect on POST reciever [RSS Feed]

#1 Jan. 17, 2011 17:20:15

c.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[django] error CSRF token missing or incorrect on POST reciever


I tried to make a quick search box for my site-in-progress and
expected it to be as simple as keeping the database updated.
Unfortunately I ran into the following error as soon as I POSTed a
query:
Forbidden (403)

CSRF verification failed. Request aborted.

Help

Reason given for failure:
CSRF token missing or incorrect. In general, this can occur when there
is a genuine Cross Site Request Forgery, or when Django's CSRF
mechanism has not been used correctly. For POST forms, you need to
ensure:

The view function uses RequestContext for the template, instead of
Context.
In the template, there is a {% csrf_token %} template tag inside
each POST form that targets an internal URL.
If you are not using CsrfViewMiddleware, then you must use
csrf_protect on any views that use the csrf_token template tag, as
well as those that accept the POST data.

You're seeing the help section of this page because you have DEBUG =
True in your Django settings file. Change that to False, and only the
initial error message will be displayed.
You can customize this page using the CSRF_FAILURE_VIEW setting.
I tried adding "{% csrf_token %}" to my template, but still got the
same error. I don't really know what the rest of the suggestions mean,
so any translation help would be appreciated

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Jan. 17, 2011 17:26:47

Jirka V.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[django] error CSRF token missing or incorrect on POST reciever


Hmm,

have you checked documentation at all? The token is not the only
thing, you need to enable a middleware too (a few things are needed
basically).

Cheers

Jirka

http://docs.djangoproject.com/en/dev/ref/contrib/csrf/--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » [django] error CSRF token missing or incorrect on POST reciever [RSS Feed]

Board footer

Moderator control

Enjoy the 21st of August
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support