I have inherited a Django app that I initially got working on Django 1.9. Recently I have migrated it to Django 1.11 and Python 3.4 (from 2.7). Since then, some admin view that I have has started failing with a 403 Forbidden error, CSRF verification failed. I looked at the documentation, and checked the following things:
MIDDLEWARE_CLASSES, but django.middleware.csrf.CsrfViewMiddleware is included in my configuration (it's second, after SessionMiddleware and CommonMiddleware).{% csrf_token %} stuff.render_to_response(), and passes RequestContext(request) as the third argument to it.(None of these changed during or after the Django/Python upgrades, as far as I know.)
I'm not that experienced with Django, although I have quite a bit of Python web programming experience. What am I missing/how could I debug further?
The context_instance parameter was deprecated in 1.8 and was subsequently removed in 1.10. If you need the request in the context, use render() instead and pass the request as the first argument. You should pass the context as a plain dictionary in the third parameter.