1

Problem with CSRF setting
 

Tried to login, and got the following exception. Looks like there needs to be a 'CSRF_FAILURE_VIEW' variable in settings.py

AttributeError at /account/signin/
'Settings' object has no attribute 'CSRF_FAILURE_VIEW'
Request Method: POST
Request URL:    http://test.com:8000/account/signin/
Exception Type: AttributeError
Exception Value:    
'Settings' object has no attribute 'CSRF_FAILURE_VIEW'
Exception Location: /usr/local/lib/python2.6/site-packages/django/utils/functional.py in __getattr__, line 276
Python Executable:  /usr/local/bin/python
Python Version: 2.6.6

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
updated 14 years ago
Benoit's avatar
875
Benoit
asked 14 years ago

Comments

see more comments

1 Answer

0

Hi Benoit,

Yes the settings.py file will need to be modified.

Add:

CSRF_COOKIE_NAME = 'somename'
CSRF_COOKIE_DOMAIN = 'example.com' #your domain name

and to TEMPLATE_CONTEXT_PROCESSORS add:

'django.core.context_processors.csrf',

That CSRF_FAILURE_VIEW is missing is a defect, but you only see that when there is a csrf error, which hopefully will go away soon.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 14 years ago
link

Comments

With an influx of new users, we're starting to see more of the CSRF_FAILURE_VIEW messages (they have a wrong URL, but still) Is there a way to simply redirect to a static page instead of showing the exception?
Benoit's avatar Benoit (13 years ago)
see more comments