... duplicate models when a module is reloaded. Previously a RuntimeError was raised every time two models clashed in the app registry. ( #23621 ). Prevented flush from loading initial data for migrated apps ( #23699 ). Fixed a makemessages regression in 1. ... al if all apps have migrations ( #23975 ). Made admin system checks run for custom AdminSite s ( #23497 ). Ensured the app registry is fully populated when unpickling models. When an external script (like a queueing infrastructure) reloads pickled models ... , it could crash with an AppRegistryNotReady exception ( #24007 ). Added quoting to field indexes in the SQL generated by migrations to prevent a crash when th ... ... Is. As the concept of Django applications matured, this code showed some shortcomings. It has been refactored into an "app registry" where models modules no longer have a central role and where it's possible to attach configuration data to applications. ... tialize Django at the beginning of your script with: >>> import django >>> django . setup () Otherwise, you will hit an AppRegistryNotReady exception. WSGI scripts Until Django 1.3, the recommended way to create a WSGI application was: import django.core ... on () If you're still using the former style in your WSGI script, you need to upgrade to the latter, or you will hit an AppRegistryNotReady exception. App registry consistency It is no longer possible to have multiple installed applications with the same ... ... トでなければなりません;第一引数はプロジェクトの履歴において処理の場所が一致している履歴を反映したモデルを含んだ django.apps.registry.Apps のインスタンスであり、第二引数は SchemaEditor のインスタンスです。 reverse_code 引数はマイグレーションを元に戻す際に呼 ... ます: from django.db import migrations def forwards_func ( apps , schema_editor ): # We get the model from the versioned app registry; # if we directly import it, it'll be the wrong version Country = apps . get_model ( "myapp" , "Country" ) db_alias = sche ... ... め、これらのカスタムな user テストモデルはもう作成されなくなり、テストのコンテキストでは役に立たないものになりました。 Apps registry is no longer auto-populated when unpickling models outside of Django The apps registry is no longer auto-populated when un ... ... _MODULE or called configure() , you'll need to call django.setup() to load your settings and populate Django's application registry. For example: import django from django.conf import settings from myapp import myapp_defaults settings . configure ( defau ... ... ironment variable for this purpose. Tips for writing tests Isolating model registration To avoid polluting the global apps registry and prevent unnecessary table creation, models defined in a test method should be bound to a temporary Apps instance. To d ... ... Red Hat distribution, mime-support on a Debian distribution, or by editing the keys under HKEY_CLASSES_ROOT in the Windows registry. このビューは、 runserver (および DEBUG 設定が True に設定されている場合) によって自動的に有効になります。異なるローカル開 ... ... on and have RunPython use it. RunPython expects a callable as its argument which takes two arguments - the first is an app registry that has the historical versions of all your models loaded into it to match where in your history the migration sits, and ... ... transform=True must_revalidate=True stale_while_revalidate=num_seconds no_cache=True 既知のディレクティブの全リストは IANA registry にあります (すべてのディレクティブがレスポンスに適用されるわけではないことに注意してください)。 ヘッダーを使用してキャッシ ... ... のどのモデルクラスと関係しているのか、関係先のモデルクラスが読み込まれるまで分からないはずです。 The answer lies in the app registry . When Django starts, it imports each application listed in INSTALLED_APPS , and then the models module inside each applic ... 2026年10月08日