[Django] CSRF verification failed.

取りあえずDjangoはじめて、とりあえずformつくって、とりあえずPOSTしてみて「CSRF verification failed.」って出たらsettings.pyのMIDDLEWARE_CLASSESにdjango.middleware.csrf.CsrfResponseMiddlewareを入れとくとおk


MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.csrf.CsrfResponseMiddleware', # <-コレ
)
 iTunes Store(Japan)
 iTunes Store(Japan)
 iTunes Store(Japan)
 iTunes Store(Japan)
 iTunes Store(Japan)
Filed under: Django,Programming,Python — maesan 7:30 PM