django报错解决 Forbidden (403) CSRF verification failed. Request aborted.
报错内容
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:
解决办法
setting.py 文件加入以下内容
www.***.com
为你当前访问域名文章来源:https://www.toymoban.com/news/detail-703352.html
CSRF_TRUSTED_ORIGINS = ['https://**.com',]
搞定文章来源地址https://www.toymoban.com/news/detail-703352.html
到了这里,关于django报错解决 Forbidden (403) CSRF verification failed. Request aborted.的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!