Django error resolution Forbidden (403) CSRF verification failed. Request aborted.

Django error resolution Forbidden (403) CSRF verification failed. Request aborted.

Error content

Forbidden (403)
CSRF verification failed. Request aborted.

Help
Reason given for failure:

    Origin checking failed - https://active-mantis-distinct.ngrok-free.app does not match any trusted origins.
    
In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django’s CSRF mechanism has not been used correctly. For POST forms, you need to ensure:

Solution

Add the following content to the setting.py file

www.***.com
is the domain name you are currently visiting

CSRF_TRUSTED_ORIGINS = ['https://**.com',]

Done

Guess you like

Origin blog.csdn.net/gixome/article/details/132781919