... c to a particular database backend and will be skipped if run with a different backend. Some tests are skipped or expected failures on a particular database backend (see DatabaseFeatures.django_test_skips and DatabaseFeatures.django_test_expected_failur ... s . For example, tests for contrib.auth are located in tests/auth_tests . トラブルシューティング Test suite hangs or shows failures on main branch Ensure you have the latest point release of a supported Python version , since there are often bugs in ear ... ntests.py Or add export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES to your shell's startup file (e.g. ~/.profile ). Many test failures with UnicodeEncodeError If the locales package is not installed, some tests will fail with a UnicodeEncodeError . You can ... ... were not affected by this vulnerability. バグ修正 Fixed a bug in Django 3.1 where the output was hidden on a test error or failure when using test --pdb with the --buffer option ( #32560 ). ... ... the test runners ( tests/runtests.py and python manage.py test ) no longer represents the number of failed tests, since a failure of 256 or more tests resulted in a wrong exit status code. The exit status code for the test runner is now 0 for success ( ... no failing tests) and 1 for any number of test failures. If needed, the number of test failures can be found at the end of the test runner's output. Cookie encoding To fix bugs ... ... 変数よりも少し複雑です。以下に注意すべき点を示します: この変数が呼び出されたときに例外が発生した場合、例外が silent_variable_failure 属性の値が True でない限り、例外は伝播します。例外に silent_variable_failure 属性があり、その値が True である場合、その変数 ... ceback (most recent call last): ... AssertionError : foo >>> class SilentAssertionError ( Exception ): ... silent_variable_failure = True ... >>> class PersonClass4 : ... def first_name ( self ): ... raise SilentAssertionError ... >>> p = PersonClass4 ( ... xceptions.ObjectDoesNotExist はすべての Django データベース API の DoesNotExist 例外用の基本クラスですが、 silent_variable_failure = True を持っていることに注意してください。そのため、 Django モデルオブジェクトで Django テンプレートを使っている場合、 Do ... ... ving readability and resolving problems referring to objects whose primary key value may not be predictable or known. Fast failure for tests Both the test subcommand of django-admin.py and the runtests.py script used to run Django's own test suite now s ... upport a --failfast option. When specified, this option causes the test runner to exit after encountering a failure instead of continuing with the test run. In addition, the handling of Ctrl-C during a test run has been improved to trigge ... he test runners ( tests/runtests.py and python manage.py test ) no longer represents the number of failed tests, because a failure of 256 or more tests resulted in a wrong exit status code. The exit status code for the test runner is now 0 for success ( ... ... orted Python version. It's possible you may encounter errors using an earlier point release. If you have a small number of failures, it may be worth investigating whether they are known issues, or using the django-docker-box project to run the tests. Si ... a weird machine configuration problem. Make a note of the failing tests before you start, so you can tell whether a later failure was caused by your changes. Build the documentation: / $ cd docs && make html && cd .. ...\> cd docs && make.bat html ... ... considered valid , even if that version is listed as supported by Django. User input must be sanitized Reports based on a failure to sanitize user input are not valid security vulnerabilities. It is the developer's responsibility to properly handle use ... ffect local development, for example when using runserver . Exploits which fail to follow security best practices, such as failure to sanitize user input. For other examples, see our security documentation . Exploits in AI generated code that do not adh ... ... アよりも前に、 SessionMiddleware が MIDDLEWARE に登録されている必要があります。 Middleware の順序 を参照してください。 CSRF_FAILURE_VIEW デフォルト値: 'django.views.csrf.csrf_failure' CSRF保護 によって受信リクエストが拒否された場合に使用されるビュー関数へ ... のドット区切りパス。関数には次のシグネチャが必要です: def csrf_failure ( request , reason = "" ): ... reason は、リクエストが拒否された理由を示す短いメッセージ(開発者やログ用であり、エンドユー ... ザー向けではありません)です。これは HttpResponseForbidden を返すべきです。 django.views.csrf.csrf_failure() は追加の template_name パラメータを受け付け、デフォルトでは '403_csrf.html' になっています。その名前のテンプレートが存在 ... ... されるべきです。 エラーページはとてもユーザーフレンドリーではないので、独自のビューを提供したいと考えるかもしれません。 CSRF_FAILURE_VIEW の設定で実現できます。 CSRF の認証失敗は、 django.security.csrf ロガーに警告として記録されます。 キャッシュによるCSRF ... ... AGE CSRF_COOKIE_DOMAIN CSRF_COOKIE_HTTPONLY CSRF_COOKIE_NAME CSRF_COOKIE_PATH CSRF_COOKIE_SAMESITE CSRF_COOKIE_SECURE CSRF_FAILURE_VIEW CSRF_HEADER_NAME CSRF_TRUSTED_ORIGINS CSRF_USE_SESSIONS よくある質問 任意の CSRF トークンのペア(クッキーと POST データ ... 2026年10月08日