... 別する必要がある場合に使用します。 sites フレームワークは、主にこのモデルに基づいています: class models. Site ウェブサイトの domain と name 属性を格納するモデル。 domain ウェブサイトに関連付けられた完全修飾ドメイン名。たとえば、 www.example.com 。 name 人 ... に関連付けられている Site オブジェクトのデータベース ID を指定します。この設定が省略された場合、 get_current_site() 関数は、 domain と request.get_host() メソッドからのホスト名を比較することで、現在のサイトを取得しようとします。 これをどのように使用するか ... he site IDs like that, in case they change. The cleaner way of accomplishing the same thing is to check the current site's domain: from django.contrib.sites.shortcuts import get_current_site def my_view ( request ): current_site = get_current_site ( re ... ... L must end in a slash Previously, the MEDIA_URL setting only required a trailing slash if it contained a suffix beyond the domain name. A trailing slash is now required for MEDIA_URL and the new STATIC_URL setting as long as it is not blank. This ensur ... ilt-in filter to fix this problem would require significant effort, and since natural language processing isn't the normal domain of a web framework, we have "fixed" the problem by making the list of prohibited words an empty list. If you want to resto ... ferent translations found on disk, namely: For translatable literals found in Python code and templates ( 'django' gettext domain): Priorities of translations included with applications listed in the INSTALLED_APPS setting were changed. To provide a be ... ... s of Django -- independent of end-user-written applications -- make use of full URLs, including domain name, which are generated from the HTTP Host header. Django's documentation has for some time contained notes advising use ... der. For this reason, Django 1.3.6 adds a new setting, ALLOWED_HOSTS , which should contain an explicit list of valid host/domain names for this site. A request with a Host header not matching an entry in this list will raise SuspiciousOperation if req ... ... header poisoning Some parts of Django -- independent of end-user-written applications -- make use of full URLs, including domain name, which are generated from the HTTP Host header. Django's documentation has for some time contained notes advising use ... s Host header. For this reason, Django 1.4.4 adds a new setting, ALLOWED_HOSTS , containing an explicit list of valid host/domain names for this site. A request with a Host header not matching an entry in this list will raise SuspiciousOperation if req ... ... server-provided value of SCRIPT_NAME (or / if not set), when set to a URL specifying the protocol but without a top-level domain, e.g. http://myhost/ ( #32304 ). ... ... django.views.static.serve() A maliciously crafted URL to a Django site using the serve() view could redirect to any other domain. The view no longer does any redirects as they don't provide any known, useful functionality. Note, however, that this vie ... ... ダーの存在が HTTP 下では十分に信頼できないため、HTTP リクエストに対してはリファラチェックは行われません。) もし CSRF_COOKIE_DOMAIN 設定が設定されていれば、リファラはその設定と比較されます。先頭のドットを指定することで、クロスサブドメインリクエストを許可 ... できます。たとえば、 CSRF_COOKIE_DOMAIN = '.example.com' は www.example.com と api.example.com からの POST リクエストを許可します。この設定が設定されていない場合、 ... CSRF クッキーを送信させます。 設定 Django の CSRF 動作を制御するための、多くの設定があります: CSRF_COOKIE_AGE CSRF_COOKIE_DOMAIN CSRF_COOKIE_HTTPONLY CSRF_COOKIE_NAME CSRF_COOKIE_PATH CSRF_COOKIE_SAMESITE CSRF_COOKIE_SECURE CSRF_FAILURE_VIEW CSRF_HEAD ... ... で使用されるエラーコードです。デフォルトは "invalid" です。 allowlist メールドメインの許可リスト。デフォルトでは、正規表現( domain_regex 属性)を使って @ 記号の後に現れる文字列を検証します。しかし、その文字列が allowlist に含まれている場合、この検証はバイ ... st'] です。ドットを含まない他のドメインはバリデーションを通過しないので、必要に応じて allowlist に追加する必要があります。 DomainNameValidator class DomainNameValidator ( accept_idna = True , message = None , code = None ) [ソース] RegexValidator のサブ ... す。IPアドレスは有効なドメイン名としては受け付けられません。 親クラスである RegexValidator クラスのオプション引数に加えて、 DomainNameValidator は以下の追加のオプション属性を受け付けます。 accept_idna 国際化ドメイン名、つまり非ASCII文字を含むドメイン名を ... ... django.views.static.serve() A maliciously crafted URL to a Django site using the serve() view could redirect to any other domain. The view no longer does any redirects as they don't provide any known, useful functionality. Note, however, that this vie ... ... 2026年10月08日