Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我刚刚升级到 Django 1.2,我正在尝试运行我的项目。登录后我得到
Forbidden (403) CSRF verification failed. Request aborted.
这很奇怪,因为我之前没有启用 CSRF 保护。我是否必须配置其他东西才能让我的项目工作?
是的,那是因为您使用 contrib.admin 视图通过自定义模板登录。您应该将 csrf_token 添加到您的登录模板中。
看来,我用于登录的 contrib.admin 视图启用了 CSRF 保护。这就是我得到 403 的原因。