Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

125
Visualizações
csrftoken tag not working after upgrade to Django 1.11

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:

  1. I'm still using MIDDLEWARE_CLASSES, but django.middleware.csrf.CsrfViewMiddleware is included in my configuration (it's second, after SessionMiddleware and CommonMiddleware).
  2. The template used includes the {% csrf_token %} stuff.
  3. The view uses 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?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

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.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda