Ask Your Question
1

Problem with CSRF setting

asked 2011-04-25 09:14:59 -0500

Benoit gravatar image Benoit flag of United States
865 22 8 31

updated 2011-04-25 18:10:49 -0500

Evgeny gravatar image Evgeny flag of Chile
11009 50 84 182
http://askbot.org/

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
delete close flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2011-04-25 12:02:20 -0500

Evgeny gravatar image Evgeny flag of Chile
11009 50 84 182
http://askbot.org/

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.

link publish delete flag offensive edit

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 ( 2011-05-17 09:57:25 -0500 )edit

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Reliable Askbot Hosting

Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.

create your Q&A site
30 days free trial

Question tools

Follow

subscribe to rss feed

Stats

Asked: 2011-04-25 09:14:59 -0500

Seen: 768 times

Last updated: Apr 25 '11