diff --git a/NEWS b/NEWS
index 462b0c6..4acd365 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,10 @@
 
   * Sphinxified documentation. (Lukasz Balcerzak)
 
+  * Added an entry point (dulwich.web.make_paster_app) for Paste.Deploy to be
+    able to determine how to create an instance of HTTPGitApplication.
+    (David Blewett)
+
 0.7.0	2011-01-21
 
  FEATURES
diff --git a/dulwich/web.py b/dulwich/web.py
index 3f354db..b55434b 100644
--- a/dulwich/web.py
+++ b/dulwich/web.py
@@ -29,6 +29,7 @@ try:
 except ImportError:
     from dulwich._compat import parse_qs
 from dulwich import log_utils
+from dulwich.errors import NotGitRepository
 from dulwich.protocol import (
     ReceivableProtocol,
     )
@@ -362,6 +363,97 @@ class HTTPGitApplication(object):
             return req.not_found('Sorry, that method is not supported')
         return handler(req, self.backend, mat)
 
+def make_paster_app(global_config, **local_conf):
+    """Factory function for a Paster WSGI app
+    append_git=True will make each served git repo have .git appended to its
+        served URL.
+
+    Two options to serve: serve_dirs and individual URL path to operating
+    system path mappings.
+    Example:
+        File-system layout:
+            +-/var/lib/git
+            |-foo
+            |-bar
+            `-baz
+
+            +-/home/git
+            |-bing
+            `-bang
+
+        paster.ini:
+            [app:main]
+            use = egg:dulwich
+            append_git = True
+            serve_dirs =
+                /var/lib/git
+                /home/git
+            blerg = /home/dannyboy/src/blerg
+
+    Will result in the following being served:
+    /foo.git   => /var/lib/git/foo
+    /bar.git   => /var/lib/git/bar
+    /baz.git   => /var/lib/git/baz
+    /bing.git  => /home/git/bing
+    /bang.git  => /home/git/bang
+    /blerg.git => /home/dannyboy/src/blerg
+
+    NOTE: The last name definition wins. Whatever directory in serve_dirs is
+          last, or the last explicit mapping for the same name is what will
+          be mapped.
+    """
+    from paste.deploy.converters import asbool
+    from paste.deploy.converters import aslist
+    repos = {}
+    append_git = asbool(local_conf.pop('append_git', False))
+    serve_dirs = aslist(local_conf.pop('serve_dir', None))
+    log_utils.default_logging_config()
+
+    def add_repo(mapping, path, gitdir):
+        try:
+            mapping[path] = Repo(gitdir)
+        except NotGitRepository:
+            logger.error('Not a git repository, cannot serve: "%s".',
+                         gitdir)
+
+    if not local_conf:
+        add_repo(repos, '/', os.getcwd())
+    else:
+        if serve_dirs:
+            for top_dir in serve_dirs:
+                if not os.path.isdir(top_dir):
+                    logger.error('Not a directory, cannot serve: "%s".',
+                                 top_dir)
+
+                for d in os.listdir(top_dir):
+                    repo_path = '/'.join(('', d))
+                    gitdir = os.path.sep.join(top_dir, d)
+                    add_repo(repos, repo_path, gitdir)
+
+        for repo_name, gitdir in local_conf.items():
+            repo_path = '/'.join(('', repo_name))
+            add_repo(repos, repo_path, gitdir)
+
+    if not repos:
+        msg = 'No repositories to serve, check the ini file: "%s".'
+        logger.error(msg, global_config['__file__'])
+        raise IndexError(msg % global_config['__file__'])
+
+    if append_git:
+        new_repos = {}
+        for rpath, repo in repos.items():
+            if rpath.endswith('.git'):
+                # Don't be redundant...
+                new_repos[rpath] = repo
+                logger.debug('Not renaming, already ends in .git: "%s".',
+                             rpath)
+            else:
+                new_repos['.'.join((rpath, 'git'))] = repo
+        backend = DictBackend(new_repos)
+    else:
+        backend = DictBackend(repos)
+    return  HTTPGitApplication(backend)
+
 
 # The reference server implementation is based on wsgiref, which is not
 # distributed with python 2.4. If wsgiref is not present, users will not be able
diff --git a/setup.py b/setup.py
index 17be056..f4f3b86 100755
--- a/setup.py
+++ b/setup.py
@@ -27,12 +27,12 @@ class DulwichDistribution(Distribution):
         return not self.pure
 
     global_options = Distribution.global_options + [
-        ('pure', None, 
+        ('pure', None,
             "use pure (slower) Python code instead of C extensions")]
 
     pure = False
 
-        
+
 setup(name='dulwich',
       description='Python Git Library',
       keywords='git',
@@ -61,4 +61,7 @@ setup(name='dulwich',
               include_dirs=include_dirs),
           ],
       distclass=DulwichDistribution,
+      entry_points={
+          'paste.app_factory': 'main=dulwich.web:make_paster_app'
+          }
       )
