Mercurial > hg > simpypi
changeset 12:1cdb25cef7ee
print helpful message when running test app
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 28 Feb 2012 14:37:21 -0800 |
parents | 2bfcba075db0 |
children | fc44434040e5 |
files | simpypi/dispatcher.py simpypi/factory.py |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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()
--- 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)