Search code examples
djangoazuredjango-csrf

Django app runing on Azure Web App + Database PostgreSQL - csrf error


My application is running on Azure, but I get a csrf error on the login page. And yet:

  1. My template has the {% csrf_token %} within the element:
  2. I have 'django.middleware.csrf.CsrfViewMiddleware', in the MIDDLEWARE definition in settings.py.

In addition, you have to know that the same code (besides the migration required by the PostgreSQL usage) is running on another Azure instance with sqlite and is working correctly.

As I am a newbie in Azure and web developmeent, any hint is welcome.

Best regards


Solution

  • I got it! I simply forgotten to update the CSRF_TRUSTED_ORIGINS value in the settings.py for the new instance!