Index: django/db/models/loading.py
===================================================================
--- django/db/models/loading.py	(revision 6789)
+++ django/db/models/loading.py	(working copy)
@@ -5,9 +5,16 @@
 import sys
 import os
 import threading
+try:
+    from pkg_resources import working_set, DistributionNotFound, \
+        Environment, VersionConflict, UnknownExtra
+except ImportError:
+    pkg_resources_is_available = True
+else:
+    pkg_resources_is_available = False
 
 __all__ = ('get_apps', 'get_app', 'get_models', 'get_model', 'register_models',
-        'load_app', 'app_cache_ready')
+        'load_app', 'app_cache_ready', 'get_all_apps')
 
 class AppCache(object):
     """
@@ -49,7 +56,7 @@
         try:
             if self.loaded:
                 return
-            for app_name in settings.INSTALLED_APPS:
+            for app_name in self.get_all_apps():
                 if app_name in self.handled:
                     continue
                 self.load_app(app_name, True)
@@ -60,6 +67,30 @@
         finally:
             self.write_lock.release()
 
+    def get_all_apps(self):
+        """
+        Looks for apps in the directories defined by the ``APP_DIRS`` setting
+        if ``pkg_resources`` (part of setuptools) is installed.
+
+        Every module having the entry point like the setting ``APP_ENTRY_POINT``
+        will be added to the Python path, if necesary.
+
+        Returns a tuple with INSTALLED_APPS and all found apps.
+        """
+        APP_LIST = []
+        if pkg_resources_is_available:
+            # find every "distribution" in the app directory paths and add
+            # them to the "working_set", effectively setting the PYTHONPATH
+            app_environment = Environment(settings.APPS_DIRS)
+            map(working_set.add, working_set.find_plugins(app_environment)[0])
+            # look for entry points in all distributions currently on the
+            # PYTHONPATH and add matching modules to INSTALLED_APPS
+            for entry in working_set.iter_entry_points(settings.APP_ENTRY_POINT):
+                app = entry.module_name
+                if app not in settings.INSTALLED_APPS and app not in APP_LIST:
+                    APP_LIST.append(app_name)
+        return settings.INSTALLED_APPS + tuple(APP_LIST)
+
     def load_app(self, app_name, can_postpone=False):
         """
         Loads the app with the provided fully qualified name, and returns the
@@ -185,3 +216,4 @@
 register_models = cache.register_models
 load_app = cache.load_app
 app_cache_ready = cache.app_cache_ready
+get_all_apps = cache.get_all_apps
Index: django/conf/global_settings.py
===================================================================
--- django/conf/global_settings.py	(revision 6789)
+++ django/conf/global_settings.py	(working copy)
@@ -134,6 +134,12 @@
 # List of strings representing installed apps.
 INSTALLED_APPS = ()
 
+# List of locations of reusable apps, in search order.
+APP_DIRS = ()
+
+# Entry point name of reusable Django apps
+APP_ENTRY_POINT = 'django.apps'
+
 # List of locations of the template source files, in search order.
 TEMPLATE_DIRS = ()
 
Index: setup.py
===================================================================
--- setup.py	(revision 6789)
+++ setup.py	(working copy)
@@ -1,5 +1,13 @@
-from distutils.core import setup
-from distutils.command.install import INSTALL_SCHEMES
+try:
+    from setuptools import setup
+except ImportError:
+    from distutils.core import setup
+    from distutils.command.install import INSTALL_SCHEMES
+    # Tell distutils to put the data_files in platform-specific installation
+    # locations. See here for an explanation:
+    # http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
+    for scheme in INSTALL_SCHEMES.values():
+        scheme['data'] = scheme['purelib']
 import os
 import sys
 
@@ -17,12 +25,6 @@
         return result
     return fullsplit(head, [tail] + result)
 
-# Tell distutils to put the data_files in platform-specific installation
-# locations. See here for an explanation:
-# http://groups.google.com/group/comp.lang.python/browse_thread/thread/35ec7b2fed36eaec/2105ee4d9e8042cb
-for scheme in INSTALL_SCHEMES.values():
-    scheme['data'] = scheme['purelib']
-
 # Compile the list of packages available, because distutils doesn't have
 # an easy way to do this.
 packages, data_files = [], []
@@ -46,18 +48,29 @@
 # Dynamically calculate the version based on django.VERSION.
 version_tuple = __import__('django').VERSION
 if version_tuple[2] is not None:
-    version = "%d.%d_%s" % version_tuple
+    version = "%d.%d%s" % version_tuple
 else:
     version = "%d.%d" % version_tuple[:2]
 
 setup(
     name = "Django",
     version = version,
+    license = 'BSD',
     url = 'http://www.djangoproject.com/',
     author = 'Lawrence Journal-World',
     author_email = 'holovaty@gmail.com',
     description = 'A high-level Python Web framework that encourages rapid development and clean, pragmatic design.',
     packages = packages,
     data_files = data_files,
+    install_requires = ['setuptools>=0.6c7', 'Flup'],
     scripts = ['django/bin/django-admin.py'],
+    extras_require = {
+        'MySQL':  ["MySQLdb>=1.2.1p2"],
+        'SQLite': ["pysqlite>=2.0.3"],
+        'PostgreSQL': ["psycopg>=1.1.21"],
+        'PostgreSQL2': ["psycopg2>=2.0.5"],
+        'Oracle': ["cx_Oracle>=4.3.1"],
+        'PyYaml': ["PyYaml"],
+    },
+    zip_safe = False,
 )
Index: docs/install.txt
===================================================================
--- docs/install.txt	(revision 6789)
+++ docs/install.txt	(working copy)
@@ -224,6 +224,48 @@
 command ``svn update`` from within the ``django-trunk`` directory. When you do
 this, Subversion will automatically download any changes.
 
+Installing using setuptools' ``develop`` command 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**New in Django development version**
+
+If you already installed setuptools_ you can skip step 3 and 4 of the
+instructions above and use the ``develop`` command of setuptools instead::
+
+    python setup.py develop
+
+This adds a special file automatically to your system's ``site-packages``
+directory and enables the Python intepreter to find the Django checkout without the need to create a symbolic link or to set the ``PYTHONPATH`` environment variable. This is also platform-independent.
+
+Installing using easy_install
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+**New in Django development version**
+
+If you want to benefit from setuptools_'s package management and dependency tracking, don't hesitate to install Django with easy_install_.
+
+1. Make sure that you have Subversion_ and setuptools_ installed, and that you
+   can run its commands from a shell. (Enter ``svn help`` or
+   ``easy_install --help`` at a shell prompt to test this.)
+
+2. Install Django's main development branch (the 'trunk') like so::
+
+    easy_install http://code.djangoproject.com/svn/django/trunk/
+
+   The above line checks out Django's source automatically and runs
+   ``python setup.py install`` for you.
+
+If you want setuptools to install one of several recommended extras or a
+Python database binding during Django's installation, you can also use
+easy_install_ like this::
+
+    easy_install Django[PostgreSQL]
+    easy_install Django[SQLite, PyYaml]
+
+To see a full list of the available extras, open ``setup.py`` and look at the
+``extras_require`` keyword.
+
+
 .. _`download page`: http://www.djangoproject.com/download/
 .. _Subversion: http://subversion.tigris.org/
 .. _from the Control Panel: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sysdm_advancd_environmnt_addchange_variable.mspx
+.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools
+.. _easy_install: http://peak.telecommunity.com/DevCenter/EasyInstall
Index: docs/settings.txt
===================================================================
--- docs/settings.txt	(revision 6789)
+++ docs/settings.txt	(working copy)
@@ -216,6 +216,21 @@
 then ``{% ssi /home/html/foo.txt %}`` would work, but ``{% ssi /etc/passwd %}``
 wouldn't.
 
+APP_DIRS
+--------
+
+Default: ``()`` (Empty tuple)
+
+List of locations of reusable Django apps, in search order. Note that
+these paths should use Unix-style forward slashes, even on Windows.
+
+APP_ENTRY_POINT
+---------------
+
+Default: ``'django.apps'``
+
+Name of the entry point which is used to load reusable Django apps.
+
 APPEND_SLASH
 ------------
 
