まずは Csrf のミドルウェアは CsrfViewMiddleware だけで良い
とりあえず runserver して確認してみるとこんなエラーが出る。
Traceback (most recent call last): File "/usr/local/lib/python2.7/wsgiref/handlers.py", line 85, in run self.result = application(self.environ, self.start_response) File "/usr/local/lib/python2.7/site-packages/django/contrib/staticfiles/handlers.py", line 72, in __call__ return self.application(environ, start_response) File "/usr/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 236, in __call__ self.load_middleware() File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 57, in load_middleware raise exceptions.ImproperlyConfigured('Middleware module "%s" does not define a "%s" class' % (mw_module, mw_classname)) ImproperlyConfigured: Middleware module "django.middleware.csrf" does not define a "CsrfResponseMiddleware" class
で、ドキュメントにはこんな話が。
自分の setting.py には 2行入ってるぞ…。
'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.csrf.CsrfResponseMiddleware',
というわけで、CsrfResponseMiddleware を削除して問題解決。