[PATCH 14 of 15] Example webdir FastCGI script

vincent at ricardis.tudelft.nl vincent at ricardis.tudelft.nl
Wed Aug 24 16:49:22 CDT 2005


Patch subject is complete summary.


# HG changeset patch
# User Vincent Wagelaar <vincent at ricardis.tudelft.nl>
# Node ID d4383e2b77951df1466a776bccffaa628467166a
# Parent  b48e6d0b232a38560668b1c8be43cd5ab4b44ee5
Example webdir FastCGI script

diff -r b48e6d0b232a -r d4383e2b7795 hgwebdir.fcgi
--- /dev/null	Tue Aug 23 22:32:19 2005
+++ b/hgwebdir.fcgi	Tue Aug 23 22:34:41 2005
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+#
+# An example FastCGI script to export multiple hgweb repos, edit as necessary
+
+import sys
+#sys.path.insert(0, "/path/to//lib/python") # if not a system-wide install
+
+from mercurial import hgweb
+from mercurial import thfcgi
+
+web = hgweb.hgwebdir("/path/to/hgwebdir.conf")
+def handle_req(req, env, form):
+    global web
+    try:
+        web.run(req.stdin, req.out, env)
+        req.finish()
+    except SystemExit:
+        pass
+    except:
+        # You should probably log tracebacks here
+        pass
+
+
+if __name__ == "__main__":
+    fcgi = thfcgi.THFCGI(handle_req)
+    fcgi.run()


More information about the Mercurial mailing list