hgwebdir with mod_python

Sebastien Lucas sebastien.lucas at gmail.com
Mon May 21 07:25:33 CDT 2007


On 5/20/07, Matt Mackall <mpm at selenic.com> wrote:
> On Sun, May 20, 2007 at 08:53:36PM +0200, Sebastien Lucas wrote:
> > 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).
>
> This is probably a useful recipe, please add this to the wiki.

I'll do it as soon as I have time (and will) to do proper benchmark. I
won't mind if somebody beat me in the benchmarking ....... ;)


More information about the Mercurial mailing list