質問編集履歴

1

追記

2023/08/11 17:05

投稿

user0930
user0930

スコア7

test CHANGED
File without changes
test CHANGED
@@ -8,6 +8,21 @@
8
8
  ```
9
9
  アクセス禁止 (403)
10
10
  CSRF検証に失敗したため、リクエストは中断されました。
11
+ Help
12
+ Reason given for failure:
13
+
14
+ Origin checking failed - https://***********************.vfs.cloud9.ap-northeast-1.amazonaws.com does not match any trusted origins.
15
+
16
+ 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:
17
+
18
+ Your browser is accepting cookies.
19
+ The view function passes a request to the template’s render method.
20
+ In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL.
21
+ If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data.
22
+ The form has a valid CSRF token. After logging in in another browser tab or hitting the back button after a login, you may need to reload the page with the form, because the token is rotated after a login.
23
+ You’re seeing the help section of this page because you have DEBUG = True in your Django settings file. Change that to False, and only the initial error message will be displayed.
24
+
25
+ You can customize this page using the CSRF_FAILURE_VIEW setting.
11
26
  ```
12
27
 
13
28
  ### 該当のソースコード
@@ -59,6 +74,8 @@
59
74
  CSRFについて調べて、フォームの書き方が間違いかと思い、確認したのですが、
60
75
  間違っている様には見えませんでした。
61
76
 
77
+ またPythonのバージョンを上げた事に伴い、djangoのバージョンも上がったようで、それによって影響しているのかなとも、考えていますがどうでしょうか?
78
+
62
79
  ### 補足情報(FW/ツールのバージョンなど)
63
80
  python: Python 3.11.0
64
81
  django: 4.2.4