# HG changeset patch # User Jeff Hammel # Date 1330468641 28800 # Node ID 1cdb25cef7ee6b251a4ac4dca011dcdac26205c2 # Parent 2bfcba075db0be3ab75bf6c21846d5c3fc5c97c4 print helpful message when running test app diff -r 2bfcba075db0 -r 1cdb25cef7ee simpypi/dispatcher.py --- a/simpypi/dispatcher.py Tue Feb 28 14:17:20 2012 -0800 +++ b/simpypi/dispatcher.py Tue Feb 28 14:37:21 2012 -0800 @@ -14,10 +14,9 @@ ### class level variables defaults = {'auto_reload': 'False', 'template_dirs': '', - 'index': os.path.join(here, 'templates', 'index.html') } - def __init__(self, directory, **kw): + def __init__(self, directory, index=None): self.directory = directory assert os.path.exists(directory) @@ -35,6 +34,7 @@ # self.handlers = [ Index ] # cache index HTML + self.index = index or os.path.join(here, 'templates', 'index.html') assert os.path.exists(self.index) self.index = file(self.index).read() diff -r 2bfcba075db0 -r 1cdb25cef7ee simpypi/factory.py --- a/simpypi/factory.py Tue Feb 28 14:17:20 2012 -0800 +++ b/simpypi/factory.py Tue Feb 28 14:37:21 2012 -0800 @@ -34,10 +34,12 @@ import shutil import tempfile from wsgiref import simple_server + port = 8080 + print "http://localhost:%d/" % port tempdir = tempfile.mkdtemp() try: app = factory(directory=tempdir) - server = simple_server.make_server(host='0.0.0.0', port=8080, app=app) + server = simple_server.make_server(host='0.0.0.0', port=port, app=app) server.serve_forever() finally: shutil.rmtree(tempdir)