diff pylons_app/lib/hgapp.py @ 19:38235b614e3f

starting app script update moved pure wsgi app to libs,(since it's not needed)
author Marcin Kuzminski
date Sat, 27 Feb 2010 17:40:37 +0100
parents hgapp.py@564e40829f80
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pylons_app/lib/hgapp.py	Sat Feb 27 17:40:37 2010 +0100
@@ -0,0 +1,26 @@
+import logging
+from logging import Formatter, StreamHandler
+from wsgiref.simple_server import make_server
+from mercurial.hgweb.hgwebdir_mod import hgwebdir
+from mercurial.hgweb.request import wsgiapplication
+
+log = logging.getLogger(__name__)
+log.setLevel(logging.DEBUG)
+formatter = Formatter("%(asctime)s - %(levelname)s %(message)s")
+console_handler = StreamHandler()
+console_handler.setFormatter(formatter)
+log.addHandler(console_handler)
+
+def make_web_app():
+
+    repos = "hgwebdir.config"
+    hgwebapp = hgwebdir(repos)
+    return hgwebapp
+
+port = 8000
+ip = '127.0.0.1'
+
+log.info('Starting server on %s:%s' % (ip, port))
+httpd = make_server(ip, port, wsgiapplication(make_web_app))
+httpd.serve_forever()
+