Django admin error CSRF cookie not set, always admin page not rendering

Viewed 14

I got issue at rendering in django admin panel at anything, either for POST form or not , when I changed my project from HTTP to HTTPs , the issue only in the admin panel , it shows me CSRF cookie not set. settings.py

# HTTPS settings & Security
CSRF_COOKIE_DOMAIN = '.example.com'
CSRF_TRUSTED_ORIGINS = ['https://example.com']
CSRF_COOKIE_SECURE = True
CSRF_COOKIE_HTTPONLY = True

views.py

from django.views.decorators.csrf import csrf_exempt
# Create your views here.
@csrf_exempt
def login(request):
  pass

Error

Forbidden (403)
  CSRF verification failed. Request aborted.

You are seeing this message because this site requires a CSRF cookie when submitting 
forms. This cookie is required for security reasons, to ensure that your browser is not 
being hijacked by third parties.
If you have configured your browser to disable cookies, please re-enable them, at least 
for this site, or for “same-origin” requests.

Help
Reason given for failure:
  CSRF cookie not set.
0 Answers
Related