Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #16247 -- Removed wildcard expansion of application names in IN…

…STALLED_APPS.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17158 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 7872fc0dab2ad9971fb044b73ff33980aa4e7381 1 parent 33a52cd
Aymeric Augustin authored November 27, 2011
17  django/conf/__init__.py
@@ -102,23 +102,6 @@ def __init__(self, settings_module):
102 102
                     setting_value = (setting_value,) # In case the user forgot the comma.
103 103
                 setattr(self, setting, setting_value)
104 104
 
105  
-        # Expand entries in INSTALLED_APPS like "django.contrib.*" to a list
106  
-        # of all those apps.
107  
-        new_installed_apps = []
108  
-        for app in self.INSTALLED_APPS:
109  
-            if app.endswith('.*'):
110  
-                app_mod = importlib.import_module(app[:-2])
111  
-                appdir = os.path.dirname(app_mod.__file__)
112  
-                app_subdirs = os.listdir(appdir)
113  
-                app_subdirs.sort()
114  
-                name_pattern = re.compile(r'[a-zA-Z]\w*')
115  
-                for d in app_subdirs:
116  
-                    if name_pattern.match(d) and os.path.isdir(os.path.join(appdir, d)):
117  
-                        new_installed_apps.append('%s.%s' % (app[:-2], d))
118  
-            else:
119  
-                new_installed_apps.append(app)
120  
-        self.INSTALLED_APPS = new_installed_apps
121  
-
122 105
         if hasattr(time, 'tzset') and self.TIME_ZONE:
123 106
             # When we can, attempt to validate the timezone. If we can't find
124 107
             # this file, no check happens and it's harmless.
13  docs/releases/1.4.txt
@@ -953,3 +953,16 @@ Session cookies now include the ``httponly`` attribute by default to
953 953
 help reduce the impact of potential XSS attacks. For strict backwards
954 954
 compatibility, use ``SESSION_COOKIE_HTTPONLY = False`` in settings.
955 955
 
  956
+Wildcard expansion of application names in `INSTALLED_APPS`
  957
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  958
+
  959
+Until Django 1.3, :setting:`INSTALLED_APPS` accepted wildcards in application
  960
+names, like ``django.contrib.*``. The expansion was performed by a
  961
+filesystem-based implementation of ``from <package> import *``. Unfortunately,
  962
+`this can't be done reliably`_.
  963
+
  964
+This behavior was never documented. Since it is un-pythonic and not obviously
  965
+useful, it was removed in Django 1.4. If you relied on it, you must edit your
  966
+settings file to list all your applications explicitly.
  967
+
  968
+.. _this can't be done reliably: http://docs.python.org/tutorial/modules.html#importing-from-a-package

0 notes on commit 7872fc0

Please sign in to comment.
Something went wrong with that request. Please try again.