hgwebdir with mod_python

Cristian Prieto cristian at rioshu.com
Sun May 20 20:18:24 CDT 2007


Man, I was a couple of days in the irc channel asking for this without a
simple answer, this should be wrote in the wiki, very helpful!

You saved my life man, Thanks!


======================
Cristian F. Prieto

-----Original Message-----
From: mercurial-bounces at selenic.com [mailto:mercurial-bounces at selenic.com]
On Behalf Of Sebastien Lucas
Sent: domingo, 20 de mayo de 2007 12:54 p.m.
To: mercurial
Subject: hgwebdir with mod_python

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
_______________________________________________
Mercurial mailing list
Mercurial at selenic.com
http://selenic.com/mailman/listinfo/mercurial



More information about the Mercurial mailing list