summaryrefslogtreecommitdiff
path: root/django/__init__.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2013-12-30 15:42:15 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2013-12-30 22:11:17 +0100
commit80d74097b4bd7186ad99b6d41d0ed90347a39b21 (patch)
tree7b00c5113c311aaaeba4393701151e916ae7f9f0 /django/__init__.py
parent7ed20e015335076fc98ad805eaf241f8a0d872d5 (diff)
Stopped populating the app registry as a side effect.
Since it triggers imports, it shouldn't be done lightly. This commit adds a public API for doing it explicitly, django.setup(), and does it automatically when using manage.py and wsgi.py.
Diffstat (limited to 'django/__init__.py')
-rw-r--r--django/__init__.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/django/__init__.py b/django/__init__.py
index 5b4034bfed..61413abe8e 100644
--- a/django/__init__.py
+++ b/django/__init__.py
@@ -6,3 +6,12 @@ def get_version(*args, **kwargs):
# Only import if it's actually called.
from django.utils.version import get_version
return get_version(*args, **kwargs)
+
+
+def setup():
+ # Configure the settings (this happens as a side effect of accessing
+ # INSTALLED_APPS or any other setting) and populate the app registry.
+ from django.apps import apps
+ from django.conf import settings
+ apps.populate_apps(settings.INSTALLED_APPS)
+ apps.populate_models()