... を参照してください。 connection service file のサービス名と password file のパスワードを使用して接続するためには、それらを DATABASES 内のデータベース設定の OPTIONS 部分で指定しなければなりません。 settings.py DATABASES = { "default" : { "ENGINE" : "django ... D の isolation level に設定されています。 REPEATABLE READ や SERIALIZABLE などのより高いレベルの分離レベルが必要な場合は、 DATABASES 内のデータベース設定の OPTIONS 部分に指定してください。 from django.db.backends.postgresql.psycopg_any import IsolationLev ... el DATABASES = { # ... "OPTIONS" : { "isolation_level" : IsolationLevel . SERIALIZABLE , }, } 注釈 より高い分離レベルのもとでは、アプリ ... ... を補うために、 Django ではデータベースを テストミラー と定義できます。以下の (単純化した) データベース設定例を見てください: DATABASES = { "default" : { "ENGINE" : "django.db.backends.mysql" , "NAME" : "myproject" , "HOST" : "dbprimary" , # ... plus some ot ... DEPENDENCIES テスト設定を使用して存在する依存関係を指定できます。次の(単純化した)データベース構成の例を考えてみましょう: DATABASES = { "default" : { # ... db settings "TEST" : { "DEPENDENCIES" : [ "diamonds" ], }, }, "diamonds" : { # ... db settings "TE ... attern (上記参照) にマッチする名前のテストを探します。 実行可能な TestSuite インスタンスを返します。 DiscoverRunner. setup_databases ( ** kwargs ) [ソース] setup_databases() を呼び出して、テスト用データベースを作成します。 DiscoverRunner. run_checks ( dat ... ... details on installing the optional test dependencies. Running the tests requires a Django settings module that defines the databases to use. To help you get started, Django provides and uses a sample settings module that uses the SQLite database. See Usin ... t . Running tests using django-docker-box django-docker-box allows you to run the Django's test suite across all supported databases and python versions. See the django-docker-box project page for installation and usage instructions. Using another setting ... the tests with different settings, ensure that the module is on your PYTHONPATH and pass the module with --settings . The DATABASES setting in any test settings module needs to define two databases: A default database. This database should use the backen ... ... tomatic JSON serialization of list and tuple data when content_type='application/json' . The new ORACLE_MANAGED_FILES test database setting allows using Oracle Managed Files (OMF) tablespaces. Deferrable database constraints are now checked at the end of ... r versions of SQLite because they would require expensive table introspection there. DiscoverRunner now skips the setup of databases not referenced by tests . URL The new ResolverMatch.route attribute stores the route of the matching URL pattern. バリデー ... tabase_queries , TransactionTestCase.multi_db , and TestCase.multi_db attributes are deprecated in favor of SimpleTestCase.databases , TransactionTestCase.databases , and TestCase.databases . These new attributes allow databases dependencies to be declare ... ... rently being developed, and will be announced prior to the release of Django 1.3. Django 1.2 の新機能 Support for multiple databases Django 1.2 adds the ability to use more than one database in your Django project. Queries can be issued at a specific data ... making a feed a named URL. GeoDjango The most significant new feature for GeoDjango in 1.2 is support for multiple spatial databases. As a result, the following spatial database backends are now included: django.contrib.gis.db.backends.postgis django.cont ... _lookup ( self , lookup_type , value , connection , prepared = False ): ... These changes are required to support multiple databases -- db_type and get_db_prep_* can no longer make any assumptions regarding the database for which it is preparing. The conn ... ... tes. データベースクエリを作る手薄との場合、サブクラス TransactionTestCase や TestCase を使用してください。 SimpleTestCase. databases SimpleTestCase はデフォルトでデータベースクエリを許可しません。各 SimpleTestCase テストはトランザクション内で実行されないた ... め、これにより、他のテストに影響する書き込みクエリの実行を避けられます。この問題が心配でない場合は、テストクラスの databases クラス属性を '__all__' に設定することで、この振る舞いを無効化できます。 警告 SimpleTestCase とそのサブクラス (例: TestCase ... りません。 デフォルトでは、フィクスチャは default データベースにだけロードされます。複数のデータベースと TransactionTestCase.databases を使用している場合は、フィクスチャは指定されたすべてのデータベースにロードされます。 URLconf の設定 アプリケーションがヴュ ... ... nd the XHTML and internationalization of the default templates for comments. Multiple fixes for Django's support of Oracle databases, including pagination support for GIS QuerySets, more efficient slicing of results and improved introspection of existing ... ... ik, and Turkmen languages. 管理コマンド The new check --database option allows specifying database aliases for running the database system checks. Previously these checks were enabled for all configured DATABASES by passing the database tag to the command ... hat it only allows values under a certain (database-dependent) limit. Values from 0 to 9223372036854775807 are safe in all databases supported by Django. The new RESTRICT option for on_delete argument of ForeignKey and OneToOneField emulates the behavior ... cting the result and catching exceptions. This can be used to support running tests under a debugger. The new MIGRATE test database setting allows disabling of migrations during a test database creation. DiscoverRunner can now discard output for passing t ... ... . Fixed a regression in django.contrib.gis in the Google Map output on Python 3 (#20773). Made DjangoTestSuiteRunner.setup_databases properly handle aliases for the default database (#19940) and prevented teardown_databases from attempting to tear down al ... ... rties during field alteration of MySQL databases ( #24595 ). ... 2026年10月08日