hgwebdir with mod_python

Sebastien Lucas sebastien.lucas at gmail.com
Sun May 20 13:53:36 CDT 2007


Hi,

I spend some hours this afternoon trying to use mod_python with
hgwebdir. At the end I managed to have something working. I'm too fed
up to run some benchmarks right now but I think it helps. Please tell
me if I made some mistakes as I'm very new to this kind of thing.

here is the recipe (I have one directory /var/hg containing all my repos) :

- make sure mod_python is enabled.

- first download modpython_gateway.py (from
http://projects.amor.org/misc/wiki/ModPythonGateway). Don't try to use
http://trac.gerf.org/pse/wiki/WSGIHandler, it contains some bug on the
initialisation of PATH_INFO.

- Install it (in your python path or /var/hg)

- copy hgwebdir.cgi to /var/hg/hgwebdir.py

- add this function to /var/hg/hgwebdir.py :
def test(environ, start_response):
    toto = wsgiapplication(make_web_app)
    return toto (environ, start_response)

- add this to your apache configuration :
<Location /hg>
  PythonPath "sys.path + [ '/var/hg' ]"
  SetHandler mod_python
  PythonHandler modpython_gateway::handler
  PythonOption wsgi.application hgwebdir::test
</Location>

- restart apache

- enjoy

I don't know at all if this is already known or stupid but I haven't
found any clue at all searching gmane or google (except using flup
with mod_fastcgi).

Hope this helps.

Sebastien


More information about the Mercurial mailing list