Index: docs/ref/django-admin.txt
===================================================================
--- docs/ref/django-admin.txt	(revision 10008)
+++ docs/ref/django-admin.txt	(working copy)
@@ -512,6 +512,21 @@
 
     django-admin.py runserver --noreload
 
+--handler
+~~~~~~~~~
+
+Use the ``--handler`` option to specify an alternate WSGI handler class.
+This allows you to use the development server with a custom handler
+subclass instead of the default
+``django.core.handlers.wsgi.WSGIHandler``. Overriding the WSGI handler
+is useful in case you want to override any aspect of request handling,
+such as customizing 500 error handling. This option should be passed a
+dotted path to a ``WSGIHandler`` subclass.
+
+Example usage::
+
+    django-admin.py runserver --handler=wsgi.handler.WSGIHandler
+
 Examples of using different ports and addresses
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Index: django/core/management/commands/runserver.py
===================================================================
--- django/core/management/commands/runserver.py	(revision 10008)
+++ django/core/management/commands/runserver.py	(working copy)
@@ -3,12 +3,41 @@
 import os
 import sys
 
+from django.core.handlers import wsgi
+
+def load_wsgi_handler(dotted_path=None):
+    if dotted_path is None:
+        return wsgi.WSGIHandler
+    try:
+        dot = dotted_path.rindex('.')
+    except ValueError:
+        raise ValueError, "%r isn't a WSGI handler class" % dotted_path
+    handler_module, handler_classname = dotted_path[:dot], \
+                                        dotted_path[dot+1:]
+    __import__(handler_module, {}, {}, [])
+    mod = sys.modules[handler_module]
+    try:
+        handler_class = getattr(mod, handler_classname)
+    except AttributeError:
+        raise ValueError, 'Handler module "%s" does not define a "%s" \
+class' % (handler_module, handler_classname)
+    try:
+        is_subclass = issubclass(handler_class, wsgi.WSGIHandler)
+    except TypeError:
+        is_subclass = False
+    if not is_subclass:
+        raise ValueError, 'Handler class "%s" is not a WSGIHandler \
+subclass.' % dotted_path
+    return handler_class
+
 class Command(BaseCommand):
     option_list = BaseCommand.option_list + (
         make_option('--noreload', action='store_false', dest='use_reloader', default=True,
             help='Tells Django to NOT use the auto-reloader.'),
         make_option('--adminmedia', dest='admin_media_path', default='',
             help='Specifies the directory from which to serve admin media.'),
+        make_option('--handler', dest='handler',
+                    help='Specify an alterate WSGI handler class'),
     )
     help = "Starts a lightweight Web server for development."
     args = '[optional port number, or ipaddr:port]'
@@ -19,7 +48,6 @@
     def handle(self, addrport='', *args, **options):
         import django
         from django.core.servers.basehttp import run, AdminMediaHandler, WSGIServerException
-        from django.core.handlers.wsgi import WSGIHandler
         if args:
             raise CommandError('Usage is runserver %s' % self.args)
         if not addrport:
@@ -35,7 +63,7 @@
 
         if not port.isdigit():
             raise CommandError("%r is not a valid port number." % port)
-
+        WSGIHandler = load_wsgi_handler(options.get('handler'))
         use_reloader = options.get('use_reloader', True)
         admin_media_path = options.get('admin_media_path', '')
         shutdown_message = options.get('shutdown_message', '')
