How do you set up a mercurial server in a Debian droplet?

I am trying to set up the version control tool, Mercurial on my Debian8 droplet on an Apache2 server. Mercurial seems to be installed on my server however when i try to access the repository startpage of the Mercurial server, the following python code from the hgweb.cgi file is being displayed instead.

#!/usr/bin/env python
# An example hgweb CGI script, edit as necessary
# See also

# Path to repo or hgweb config to serve (see 'hg help hgweb')
config = "/var/hg/hgweb.config"

# Uncomment and adjust if Mercurial is not installed system-wide
# (consult "installed modules" path from 'hg debuginstall'):
#import sys; sys.path.insert(0, "/path/to/python/lib")

# Uncomment to send python tracebacks to the browser if an error occurs:
#import cgitb; cgitb.enable()

from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb import hgweb, wsgicgi
application = hgweb(config)
Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

This question was answered by @SphericalCow:

not sure if it is going to help, but i suspect that it is a permissions issue with the “hgweb.cgi” file - perhaps it needs to be set to execute or that it is not configured properly. I haven’t setup mercurial so it is more or less a stab in the dark.

you may wish to look into your apache2 error log files and see if there might be anything there - probably /var/log/apache2/ or something similar on Ubuntu.

View the original comment