... ーへのアクセスを制限できます。アクセスが制限されるとき、これらのデコレータは django.http.HttpResponseNotAllowed を返します。 require_http_methods ( request_method_list ) [ソース] ¶ ビューが特定のリクエストメソッドのみを受け付けるようにするデコレータです。 ... 以下のように使います。 from django.views.decorators.http import require_http_methods @require_http_methods ([ "GET" , "POST" ]) def my_view ( request ): # I can assume now that only GET or POST ... requests make it this far # ... pass リクエストメソッドは大文字で指定する必要があることに注意してください。 require_GET () ¶ ビューがGETメソッドのみを受け付けるようにするデコレータです。 require_POST () ¶ ビューがPOSTメソッドのみを受け付け ... ... ーへのアクセスを制限できます。アクセスが制限されるとき、これらのデコレータは django.http.HttpResponseNotAllowed を返します。 require_http_methods ( request_method_list ) [ソース] ¶ ビューが特定のリクエストメソッドのみを受け付けるようにするデコレータです。 ... 以下のように使います。 from django.views.decorators.http import require_http_methods @require_http_methods ([ "GET" , "POST" ]) def my_view ( request ): # I can assume now that only GET or POST ... requests make it this far # ... pass リクエストメソッドは大文字で指定する必要があることに注意してください。 require_GET () ¶ ビューがGETメソッドのみを受け付けるようにするデコレータです。 require_POST () ¶ ビューがPOSTメソッドのみを受け付け ... ... ith Apache, you can configure Apache to authenticate against Django's authentication system directly. This requires Apache version >= 2.2 and mod_wsgi >= 2.0. For example, you could: 認証されたユーザにのみ、静的/メディアファイルを Apache ... e.com WSGIProcessGroup %{GLOBAL} WSGIApplicationGroup %{GLOBAL} <Location "/secret" > AuthType Basic AuthName "Top Secret" Require valid-user AuthBasicProvider wsgi WSGIAuthUserScript /path/to/mysite.com/mysite/wsgi.py </Location> WSGIAuthUserScript ディ ... Provider wsgi WSGIAuthUserScript /path/to/mysite.com/mysite/wsgi.py WSGIAuthGroupScript /path/to/mysite.com/mysite/wsgi.py Require group secret-agents Require valid-user </Location> To support the WSGIAuthGroupScript directive, the same WSGI script mysi ... ... y WSGIPythonHome /path/to/venv WSGIPythonPath /path/to/mysite.com <Directory /path/to/mysite.com/mysite > <Files wsgi.py > Require all granted </Files> </Directory> WSGIScriptAlias の行の最初の部分は、あなたがアプリケーションを提供したいベースとなるURLパ ... lias /media/ /path/to/mysite.com/media/ Alias /static/ /path/to/mysite.com/static/ <Directory /path/to/mysite.com/static > Require all granted </Directory> <Directory /path/to/mysite.com/media > Require all granted </Directory> WSGIScriptAlias / /path/t ... o/mysite.com/mysite/wsgi.py <Directory /path/to/mysite.com/mysite > <Files wsgi.py > Require all granted </Files> </Directory> admin ファイルを配信する ¶ django.contrib.staticfiles が INSTALLED_APPS にある場合、 Dja ... ... クラスのイテラブルを返します。 アプリのレジストリが完全に入力されている必要があります。 AppConfig. get_model ( model_name , require_ready = True ) [ソース] ¶ 与えられた model_name を持つ Model を返します。 model_name は大文字小文字を区別しません。 このア ... プリケーションにそのようなモデルが存在しない場合、 LookupError を発生させます。 require_ready 引数が False に設定されていない限り、アプリのレジストリが完全に登録されている必要があります。 require_ready は apps. ... べます。 app_name はアプリのフルネームで、たとえば 'django.contrib.admin' です。 apps. get_model ( app_label , model_name , require_ready = True ) ¶ 与えられた app_label と model_name を持つ Model を返します。 ショートカットとして、このメソッドは app_lab ... ... 利用可能で、 django/utils/log.py で定義されています。 { "version" : 1 , "disable_existing_loggers" : False , "filters" : { "require_debug_false" : { "()" : "django.utils.log.RequireDebugFalse" , }, "require_debug_true" : { "()" : "django.utils.log.Requir ... at" : "[ {server_time} ] {message} " , "style" : "{" , } }, "handlers" : { "console" : { "level" : "INFO" , "filters" : [ "require_debug_true" ], "class" : "logging.StreamHandler" , }, "django.server" : { "level" : "INFO" , "class" : "logging.StreamHand ... ler" , "formatter" : "django.server" , }, "mail_admins" : { "level" : "ERROR" , "filters" : [ "require_debug_false" ], "class" : "django.utils.log.AdminEmailHandler" , }, }, "loggers" : { "django" : { "handlers" : [ "console" ... ... クラスのイテラブルを返します。 アプリのレジストリが完全に入力されている必要があります。 AppConfig. get_model ( model_name , require_ready = True ) [ソース] ¶ 与えられた model_name を持つ Model を返します。 model_name は大文字小文字を区別しません。 このア ... プリケーションにそのようなモデルが存在しない場合、 LookupError を発生させます。 require_ready 引数が False に設定されていない限り、アプリのレジストリが完全に登録されている必要があります。 require_ready は apps. ... べます。 app_name はアプリのフルネームで、たとえば 'django.contrib.admin' です。 apps. get_model ( app_label , model_name , require_ready = True ) ¶ 与えられた app_label と model_name を持つ Model を返します。 ショートカットとして、このメソッドは app_lab ... ... 利用可能で、 django/utils/log.py で定義されています。 { "version" : 1 , "disable_existing_loggers" : False , "filters" : { "require_debug_false" : { "()" : "django.utils.log.RequireDebugFalse" , }, "require_debug_true" : { "()" : "django.utils.log.Requir ... at" : "[ {server_time} ] {message} " , "style" : "{" , } }, "handlers" : { "console" : { "level" : "INFO" , "filters" : [ "require_debug_true" ], "class" : "logging.StreamHandler" , }, "django.server" : { "level" : "INFO" , "class" : "logging.StreamHand ... ler" , "formatter" : "django.server" , }, "mail_admins" : { "level" : "ERROR" , "filters" : [ "require_debug_false" ], "class" : "django.utils.log.AdminEmailHandler" , }, }, "loggers" : { "django" : { "handlers" : [ "console" ... ... ith Apache, you can configure Apache to authenticate against Django's authentication system directly. This requires Apache version >= 2.2 and mod_wsgi >= 2.0. For example, you could: 認証されたユーザにのみ、静的/メディアファイルを Apache ... e.com WSGIProcessGroup %{GLOBAL} WSGIApplicationGroup %{GLOBAL} <Location "/secret" > AuthType Basic AuthName "Top Secret" Require valid-user AuthBasicProvider wsgi WSGIAuthUserScript /path/to/mysite.com/mysite/wsgi.py </Location> WSGIAuthUserScript ディ ... Provider wsgi WSGIAuthUserScript /path/to/mysite.com/mysite/wsgi.py WSGIAuthGroupScript /path/to/mysite.com/mysite/wsgi.py Require group secret-agents Require valid-user </Location> To support the WSGIAuthGroupScript directive, the same WSGI script mysi ... ... y WSGIPythonHome /path/to/venv WSGIPythonPath /path/to/mysite.com <Directory /path/to/mysite.com/mysite > <Files wsgi.py > Require all granted </Files> </Directory> WSGIScriptAlias の行の最初の部分は、あなたがアプリケーションを提供したいベースとなるURLパ ... lias /media/ /path/to/mysite.com/media/ Alias /static/ /path/to/mysite.com/static/ <Directory /path/to/mysite.com/static > Require all granted </Directory> <Directory /path/to/mysite.com/media > Require all granted </Directory> WSGIScriptAlias / /path/t ... o/mysite.com/mysite/wsgi.py <Directory /path/to/mysite.com/mysite > <Files wsgi.py > Require all granted </Files> </Directory> admin ファイルを配信する ¶ django.contrib.staticfiles が INSTALLED_APPS にある場合、 Dja ... 2026年10月08日