Slow hgweb.cgi

Isaac Jurado diptongo at gmail.com
Thu Apr 14 10:48:01 CDT 2011


On Thu, Apr 14, 2011 at 9:20 AM, Dominik Psenner <dpsenner at gmail.com> wrote:
>
> If it's not documented anywhere, from now on it is. I hacked:
>
> #!/usr/bin/env python
> def main():
>  # Path to repo or hgweb config to serve (see 'hg help hgweb')
>  config = "/var/hg/hgweb.config"
>
>  # let the output be UTF-8
>  import os;
>  os.environ["HGENCODING"] = "UTF-8"
>
>  # Uncomment and adjust if Mercurial is not installed system-wide:
>  #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)
>  wsgicgi.launch(application)
> import profile;
> profile.run("main()")
>
> And then executed on the server:
>
> $ export SCRIPT_NAME="hgweb.cgi"
> $ ./hgweb.profile.cgi

Do you feel like adding it to the wiki? ;-)

-- 
Isaac Jurado

"The noblest pleasure is the joy of understanding"
Leonardo da Vinci


More information about the Mercurial-devel mailing list