... 属性 (とオプションのアクセサ): content_type extra_context http_method_names response_class [ render_to_response() ] template_engine template_name [ get_template_names() ] メソッド as_view() dispatch() get() get_context_data() head() http_method_not_allow ... ueryset [ get_queryset() ] response_class [ render_to_response() ] slug_field [ get_slug_field() ] slug_url_kwarg template_engine template_name [ get_template_names() ] template_name_field template_name_suffix メソッド as_view() dispatch() get() get_co ... ns [ get_paginate_orphans() ] paginator_class queryset [ get_queryset() ] response_class [ render_to_response() ] template_engine template_name [ get_template_names() ] template_name_suffix メソッド as_view() dispatch() get() get_context_data() get_pag ... ... 属性 (とオプションのアクセサ): content_type extra_context http_method_names response_class [ render_to_response() ] template_engine template_name [ get_template_names() ] メソッド as_view() dispatch() get() get_context_data() head() http_method_not_allow ... ueryset [ get_queryset() ] response_class [ render_to_response() ] slug_field [ get_slug_field() ] slug_url_kwarg template_engine template_name [ get_template_names() ] template_name_field template_name_suffix メソッド as_view() dispatch() get() get_co ... ns [ get_paginate_orphans() ] paginator_class queryset [ get_queryset() ] response_class [ render_to_response() ] template_engine template_name [ get_template_names() ] template_name_suffix メソッド as_view() dispatch() get() get_context_data() get_pag ... ... ango テンプレート言語入門 からスタートしてください。 概要 ¶ Pythonでテンプレートシステムを使うには3つのステップがあります: Engine を設定します。 テンプレートコードを Template にコンパイルします。 テンプレートを Context においてレンダリングします。 これ ... クエンドに依存しない高レベルの API に依存しています: TEMPLATES 設定の中で、各 DjangoTemplates バックエンドに対して、Djangoは Engine をインスタンス化します。 DjangoTemplates は Engine をラップし、共通のテンプレートバックエンドAPIに適応させます。 django.te ... し DjangoTemplates バックエンドを使っているのであれば、これはおそらくあなたが探しているドキュメントではありません。後述する Engine クラスのインスタンスには、そのバックエンドの engine 属性を使ってアクセスすることができ、後述する属性のデフォルトは DjangoT ... ... ango テンプレート言語入門 からスタートしてください。 概要 ¶ Pythonでテンプレートシステムを使うには3つのステップがあります: Engine を設定します。 テンプレートコードを Template にコンパイルします。 テンプレートを Context においてレンダリングします。 これ ... クエンドに依存しない高レベルの API に依存しています: TEMPLATES 設定の中で、各 DjangoTemplates バックエンドに対して、Djangoは Engine をインスタンス化します。 DjangoTemplates は Engine をラップし、共通のテンプレートバックエンドAPIに適応させます。 django.te ... し DjangoTemplates バックエンドを使っているのであれば、これはおそらくあなたが探しているドキュメントではありません。後述する Engine クラスのインスタンスには、そのバックエンドの engine 属性を使ってアクセスすることができ、後述する属性のデフォルトは DjangoT ... ... クエンドを実装する方法を説明します。テンプレートバックエンドは django.template.backends.base.BaseEngine を継承したクラスです。このクラスは get_template() と、オプションで from_string() を実装する必要があります。以下は架空の fo ... 例です: from django.template import TemplateDoesNotExist , TemplateSyntaxError from django.template.backends.base import BaseEngine from django.template.backends.utils import csrf_input_lazy , csrf_token_lazy import foobar class FooBar ( BaseEngine ): # ... Name of the subdirectory containing the templates for this engine # inside an installed application. app_dirname = "foobar" def __init__ ( self , params ): params = params . copy () option ... ... れらを DATABASES 内のデータベース設定の OPTIONS 部分で指定しなければなりません。 settings.py ¶ DATABASES = { "default" : { "ENGINE" : "django.db.backends.postgresql" , "OPTIONS" : { "service" : "my_service" , "passfile" : ".my_pgpass" , }, } } .pg_servi ... 必要がある場合は、次のように DATABASES 内のデータベース設定の OPTIONS 部分で指定してください。 DATABASES = { "default" : { "ENGINE" : "django.db.backends.postgresql" , # ... "OPTIONS" : { "assume_role" : "my_application_role" , }, }, } 接続プール ¶ Conn ... tionary of options to pass to ConnectionPool , or to True to use the ConnectionPool defaults: DATABASES = { "default" : { "ENGINE" : "django.db.backends.postgresql" , # ... "OPTIONS" : { "pool" : True , }, }, } The CONN_MAX_AGE setting must be 0 when c ... ... れらを DATABASES 内のデータベース設定の OPTIONS 部分で指定しなければなりません。 settings.py ¶ DATABASES = { "default" : { "ENGINE" : "django.db.backends.postgresql" , "OPTIONS" : { "service" : "my_service" , "passfile" : ".my_pgpass" , }, } } .pg_servi ... 必要がある場合は、次のように DATABASES 内のデータベース設定の OPTIONS 部分で指定してください。 DATABASES = { "default" : { "ENGINE" : "django.db.backends.postgresql" , # ... "OPTIONS" : { "assume_role" : "my_application_role" , }, }, } 接続プール ¶ Conn ... tionary of options to pass to ConnectionPool , or to True to use the ConnectionPool defaults: DATABASES = { "default" : { "ENGINE" : "django.db.backends.postgresql" , # ... "OPTIONS" : { "pool" : True , }, }, } The CONN_MAX_AGE setting must be 0 when c ... ... クエンドを実装する方法を説明します。テンプレートバックエンドは django.template.backends.base.BaseEngine を継承したクラスです。このクラスは get_template() と、オプションで from_string() を実装する必要があります。以下は架空の fo ... 例です: from django.template import TemplateDoesNotExist , TemplateSyntaxError from django.template.backends.base import BaseEngine from django.template.backends.utils import csrf_input_lazy , csrf_token_lazy import foobar class FooBar ( BaseEngine ): # ... Name of the subdirectory containing the templates for this engine # inside an installed application. app_dirname = "foobar" def __init__ ( self , params ): params = params . copy () option ... ... は、Django テンプレート言語の API の概要です。詳細については、 API リファレンス をご覧ください。 エンジン ¶ django.template.Engine は Django テンプレートシステムのインスタンスをカプセル化します。 Engine を直接インスタンス化する主な理由は、 Django プロジ ... ェクトの外で Django テンプレート言語を使うためです。 django.template.backends.django.DjangoTemplates は、 django.template.Engine を Django のテンプレートバックエンド API に適応させる薄いラッパーです。 テンプレート ¶ django.template.Template はコンパイ ... ルされたテンプレートを表します。テンプレートは Engine.get_template() または Engine.from_string() で取得できます。 同様に django.template.backends.django.Template は django.temp ... ... いう名前の MySQL データベースを定義した settings.py スニペットの例です。 DATABASES = { "default" : { "NAME" : "app_data" , "ENGINE" : "django.db.backends.postgresql" , "USER" : "postgres_user" , "PASSWORD" : "s3krit" , }, "users" : { "NAME" : "user_data ... " , "ENGINE" : "django.db.backends.mysql" , "USER" : "mysql_user" , "PASSWORD" : "priv4te" , }, } default データベースという概念がプロ ... ータベースを定義している settings.py スニペットの例です。 DATABASES = { "default" : {}, "users" : { "NAME" : "user_data" , "ENGINE" : "django.db.backends.mysql" , "USER" : "mysql_user" , "PASSWORD" : "superS3cret" , }, "customers" : { "NAME" : "customer ... 2026年10月08日