Index: django/conf/__init__.py
===================================================================
--- django/conf/__init__.py	(revision 11897)
+++ django/conf/__init__.py	(working copy)
@@ -11,6 +11,7 @@
 import time     # Needed for Windows
 
 from django.conf import global_settings
+from django.core.exceptions import wrap_and_raise
 from django.utils.functional import LazyObject
 from django.utils import importlib
 
@@ -72,7 +73,7 @@
         try:
             mod = importlib.import_module(self.SETTINGS_MODULE)
         except ImportError, e:
-            raise ImportError, "Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)
+            wrap_and_raise(ImportError("Could not import settings '%s' (Is it on sys.path? Does it have syntax errors?): %s" % (self.SETTINGS_MODULE, e)))
 
         # Settings that should be converted into tuples if they're mistakenly entered
         # as strings.
Index: django/core/urlresolvers.py
===================================================================
--- django/core/urlresolvers.py	(revision 11897)
+++ django/core/urlresolvers.py	(working copy)
@@ -11,7 +11,7 @@
 
 from django.http import Http404
 from django.conf import settings
-from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist
+from django.core.exceptions import ImproperlyConfigured, ViewDoesNotExist, wrap_and_raise
 from django.utils.datastructures import MultiValueDict
 from django.utils.encoding import iri_to_uri, force_unicode, smart_str
 from django.utils.functional import memoize
@@ -135,10 +135,10 @@
             self._callback = get_callable(self._callback_str)
         except ImportError, e:
             mod_name, _ = get_mod_func(self._callback_str)
-            raise ViewDoesNotExist, "Could not import %s. Error was: %s" % (mod_name, str(e))
+            wrap_and_raise(ViewDoesNotExist("Could not import %s. Error was: %s" % (mod_name, str(e))))
         except AttributeError, e:
             mod_name, func_name = get_mod_func(self._callback_str)
-            raise ViewDoesNotExist, "Tried %s in module %s. Error was: %s" % (func_name, mod_name, str(e))
+            wrap_and_raise(ViewDoesNotExist("Tried %s in module %s. Error was: %s" % (func_name, mod_name, str(e))))
         return self._callback
     callback = property(_get_callback)
 
Index: django/core/handlers/base.py
===================================================================
--- django/core/handlers/base.py	(revision 11897)
+++ django/core/handlers/base.py	(working copy)
@@ -2,6 +2,7 @@
 
 from django import http
 from django.core import signals
+from django.core.exceptions import wrap_and_raise
 from django.utils.encoding import force_unicode
 from django.utils.importlib import import_module
 
@@ -34,7 +35,7 @@
             try:
                 dot = middleware_path.rindex('.')
             except ValueError:
-                raise exceptions.ImproperlyConfigured, '%s isn\'t a middleware module' % middleware_path
+                wrap_and_raise(exceptions.ImproperlyConfigured('%s isn\'t a middleware module' % middleware_path))
             mw_module, mw_classname = middleware_path[:dot], middleware_path[dot+1:]
             try:
                 mod = import_module(mw_module)
Index: django/core/exceptions.py
===================================================================
--- django/core/exceptions.py	(revision 11897)
+++ django/core/exceptions.py	(working copy)
@@ -35,3 +35,19 @@
 class ValidationError(Exception):
     """An error while validating data."""
     pass
+
+def wrap_and_raise(new_exception):
+    """
+    Call from an except: block to raise a new exception, while keeping
+    the traceback info from the source exception.
+    
+    new_exception is be the Exception (or subclass) instance to raise.
+    """
+    import sys
+    exc_class, exc, tb = sys.exc_info()
+
+    if issubclass(exc_class, Exception):
+        raise new_exception.__class__, new_exception, tb
+    else:
+        raise new_exception
+
Index: django/contrib/auth/__init__.py
===================================================================
--- django/contrib/auth/__init__.py	(revision 11897)
+++ django/contrib/auth/__init__.py	(working copy)
@@ -1,6 +1,6 @@
 import datetime
 from warnings import warn
-from django.core.exceptions import ImproperlyConfigured
+from django.core.exceptions import ImproperlyConfigured, wrap_and_raise
 from django.utils.importlib import import_module
 
 SESSION_KEY = '_auth_user_id'
@@ -13,7 +13,7 @@
     try:
         mod = import_module(module)
     except ImportError, e:
-        raise ImproperlyConfigured, 'Error importing authentication backend %s: "%s"' % (module, e)
+        wrap_and_raise(ImproperlyConfigured('Error importing authentication backend %s: "%s"' % (module, e)))
     except ValueError, e:
         raise ImproperlyConfigured, 'Error importing authentication backends. Is AUTHENTICATION_BACKENDS a correctly defined list or tuple?'
     try:
Index: django/template/__init__.py
===================================================================
--- django/template/__init__.py	(revision 11897)
+++ django/template/__init__.py	(working copy)
@@ -52,6 +52,7 @@
 from inspect import getargspec
 
 from django.conf import settings
+from django.core.exceptions import wrap_and_raise
 from django.template.context import Context, RequestContext, ContextPopException
 from django.utils.importlib import import_module
 from django.utils.itercompat import is_iterable
@@ -970,7 +971,7 @@
         try:
             mod = import_module(module_name)
         except ImportError, e:
-            raise InvalidTemplateLibrary("Could not load template library from %s, %s" % (module_name, e))
+            wrap_and_raise(InvalidTemplateLibrary("Could not load template library from %s, %s" % (module_name, e)))
         try:
             lib = mod.register
             libraries[module_name] = lib
Index: django/template/loaders/app_directories.py
===================================================================
--- django/template/loaders/app_directories.py	(revision 11897)
+++ django/template/loaders/app_directories.py	(working copy)
@@ -7,7 +7,7 @@
 import sys
 
 from django.conf import settings
-from django.core.exceptions import ImproperlyConfigured
+from django.core.exceptions import ImproperlyConfigured, wrap_and_raise
 from django.template import TemplateDoesNotExist
 from django.template.loader import BaseLoader
 from django.utils._os import safe_join
@@ -20,7 +20,7 @@
     try:
         mod = import_module(app)
     except ImportError, e:
-        raise ImproperlyConfigured, 'ImportError %s: %s' % (app, e.args[0])
+        wrap_and_raise(ImproperlyConfigured('ImportError %s: %s' % (app, e.args[0])))
     template_dir = os.path.join(os.path.dirname(mod.__file__), 'templates')
     if os.path.isdir(template_dir):
         app_template_dirs.append(template_dir.decode(fs_encoding))
Index: django/template/defaulttags.py
===================================================================
--- django/template/defaulttags.py	(revision 11897)
+++ django/template/defaulttags.py	(working copy)
@@ -13,6 +13,7 @@
 from django.template import get_library, Library, InvalidTemplateLibrary
 from django.template.smartif import IfParser, Literal
 from django.conf import settings
+from django.core.exceptions import wrap_and_raise
 from django.utils.encoding import smart_str, smart_unicode
 from django.utils.itercompat import groupby
 from django.utils.safestring import mark_safe
@@ -924,8 +925,8 @@
             lib = get_library("django.templatetags.%s" % taglib)
             parser.add_library(lib)
         except InvalidTemplateLibrary, e:
-            raise TemplateSyntaxError("'%s' is not a valid tag library: %s" %
-                                      (taglib, e))
+            wrap_and_raise(TemplateSyntaxError("'%s' is not a valid tag library: %s" %
+                                      (taglib, e)))
     return LoadNode()
 load = register.tag(load)
 
Index: django/template/context.py
===================================================================
--- django/template/context.py	(revision 11897)
+++ django/template/context.py	(working copy)
@@ -1,4 +1,4 @@
-from django.core.exceptions import ImproperlyConfigured
+from django.core.exceptions import ImproperlyConfigured, wrap_and_raise
 from django.utils.importlib import import_module
 
 # Cache of actual callables.
@@ -123,7 +123,7 @@
             try:
                 mod = import_module(module)
             except ImportError, e:
-                raise ImproperlyConfigured('Error importing request processor module %s: "%s"' % (module, e))
+                wrap_and_raise(ImproperlyConfigured('Error importing request processor module %s: "%s"' % (module, e)))
             try:
                 func = getattr(mod, attr)
             except AttributeError:
Index: django/template/loader.py
===================================================================
--- django/template/loader.py	(revision 11897)
+++ django/template/loader.py	(working copy)
@@ -20,7 +20,7 @@
 # Python eggs) sets is_usable to False if the "pkg_resources" module isn't
 # installed, because pkg_resources is necessary to read eggs.
 
-from django.core.exceptions import ImproperlyConfigured
+from django.core.exceptions import ImproperlyConfigured, wrap_and_raise
 from django.template import Origin, Template, Context, TemplateDoesNotExist, add_to_builtins
 from django.utils.importlib import import_module
 from django.conf import settings
@@ -81,7 +81,7 @@
         try:
             mod = import_module(module)
         except ImportError:
-            raise ImproperlyConfigured('Error importing template source loader %s: "%s"' % (loader, e))
+            wrap_and_raise(ImproperlyConfigured('Error importing template source loader %s: "%s"' % (loader, e)))
         try:
             TemplateLoader = getattr(mod, attr)
         except AttributeError, e:
