CherryPy Project Download

Publishing Mercurial Repositories

Quote from Mercurial Web site: (

Mercurial (n) a fast, lightweight Source Control Management system designed for efficient handling of very large distributed projects.

If you are using Mercurial, or plan to, then it is very easy to publish your repositories on the Web using CherryPy since Mercurial's hgweb and hgwebdir Python modules are WSGI compliant.

Here is my sample source code that utilizes the hgweb module. Edit this code to suit your needs:


# Adjust host and port to suit your Web presence:

# Change this to represent your repository/ies:
    #('<virtual path>','<absolute path>'),
    ('/project1',r'C:\Program Files\DemoRepos\project1'),
    ('/project2',r'C:\Program Files\DemoRepos\project2'),
    ('/project3',r'C:\Program Files\DemoRepos\project3')

# Adjust encoding to suit or comment out:
import os

import sys
# Adjust path to your Mercurial Lib folder:
sys.path.append(r'C:\Program Files\Mercurial\Lib')
from mercurial.hgweb.hgweb_mod import hgweb

import cherrypy
for (sName,sPath) in lRepos:

Change tuples in lRepos list to indicate the repositories that you want published, first element of each tuple must have a leading forward slash.

Suggested filename is

For an example using the hgwebdir module see my sample code at:

Hosted by WebFaction

Log in as guest/cherrypy to create/edit wiki pages