Serving mercurial with mod_wsgi
Monday, September 17th, 2007Here’s a quick and easy recipe for serving a mercurial repository with mod_wsgi.
Create a file called hgwebdir.wsgi with these contents:
from mercurial.hgweb.request import wsgiapplication from mercurial.hgweb.hgwebdir_mod import hgwebdir def make_web_app(): return hgwebdir("/path/to/hgweb.config") application = wsgiapplication(make_web_app)Add it to the apache configuration:
WSGIScriptAlias /hg /path/to/hgwebdir.wsgi
[optional] To make sure nobody modifies your repository via the http interface, add ‘deny_push = *’ to the ‘[web]‘ group of hgweb.config.
Hopefully this page will save the next person a few minutes of searching.