9👍
✅
The code looks fine, Django 1.3 and 1.4 auth.views.login uses RequestContext correctly. Please check:
- Firstly clear data of browser and try again
- What’s the value of submitted csrfmiddlewaretoken
- Do you import correct Django?
- Just make sure, is there UserWarning in console like?: “A {% csrf_token %} was used in a template, but the context did not provide the value. This is usually caused by not using RequestContext.”
👤okm
3👍
- For 1.3 and 1.4, “django.middleware.csrf.CsrfResponseMiddleware” should be named “django.middleware.csrf.CsrfViewMiddleware”
- Also, for me clearing Google Chrome’s cookies made it work.
0👍
I had similar issue where my app was deployed on HTTPS. I had to change setting flag CSRF_COOKIE_HTTPONLY to false so client server can access csrf cookie.
- How to make a field editable on create and read-only on update in Django REST framework
- Is it possible to create subparsers in a django management command?
- Django custom command and cron
- Django static files on heroku
- Django on Heroku – Broken Admin Static Files
- Ruby HAML with Django?
- Django – UpdateView with inline formsets trying to save duplicate records?
- How to give initial value in modelform
Source:stackexchange.com