1 {% load comments %} 2 <form method="POST" action="{% comment_form_target %}" class="comment_form"> 3 {% csrf_token %} 4 <dl> 5 <dt class="comment_user"> 6 {{ user.username }} 7 </dt> 8 <dd class="comment_content"> 9 {{ form.comment }} 10 <input type="submit" class="eng button" value="Comment"/> 11 </dd> 12 </dl> 13 {{ form.content_type }} 14 {{ form.object_pk }} 15 {{ form.timestamp }} 16 {{ form.security_hash }} 17 <input type="hidden" name="next" value="{{ request.get_full_path }}"/> 18 </form>csrf_token 적어놓았는데도 계속 이런 오류가 발생합니다.ㅠ어떻게 해야될까요 ㅠㅠ
--
Google 그룹스 'Django-ko' 그룹에 가입했으므로 본 메일이 전송되었습니다.
웹에서 이 토론을 보려면 https://groups.google.com/d/msg/django-ko/-/0tOpErF5dvAJ을(를) 방문하세요.
이 그룹에 게시하려면 djan...@googlegroups.com(으)로 이메일을 보내세요.
그룹에서 탈퇴하려면 django-ko+...@googlegroups.com로 이메일을 보내주세요.
더 많은 옵션을 보려면 http://groups.google.com/group/django-ko?hl=ko에서 그룹을 방문하세요.
웹에서 이 토론을 보려면 https://groups.google.com/d/msg/django-ko/-/4zcUSpn75pYJ을(를) 방문하세요.
이 그룹에 게시하려면 djan...@googlegroups.com(으)로 이메일을 보내세요.
그룹에서 탈퇴하려면 django-ko+...@googlegroups.com로 이메일을 보내주세요.
더 많은 옵션을 보려면 http://groups.google.com/group/django-ko?hl=ko에서 그룹을 방문하세요.
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:
- Your browser is accepting cookies.
- The view function uses
RequestContext
for the template, instead ofContext
.- 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 usecsrf_protect
on any views that use thecsrf_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 toFalse
, and only the initial error message will be displayed.You can customize this page using the CSRF_FAILURE_VIEW setting.
MIDDLEWARE_CLASSES = (
.....
'django.middleware.csrf.CsrfViewMiddleware',
...
}
--
Google 그룹스 'Django-ko' 그룹에 가입했으므로 본 메일이 전송되었습니다.
웹에서 이 토론을 보려면 https://groups.google.com/d/msg/django-ko/-/mKbLURqPjWMJ을(를) 방문하세요.
이 그룹에 게시하려면 djan...@googlegroups.com(으)로 이메일을 보내세요.
그룹에서 탈퇴하려면 django-ko+...@googlegroups.com로 이메일을 보내주세요.
더 많은 옵션을 보려면 http://groups.google.com/group/django-ko?hl=ko에서 그룹을 방문하세요.