Mercurial > hg > GlobalNeighbors
diff globalneighbors/web.py @ 11:d1b99c695511
remove obselete data
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 25 Jun 2017 12:54:05 -0700 |
parents | 21ed15391e8a |
children | 94af113e498a |
line wrap: on
line diff
--- a/globalneighbors/web.py Sun Jun 25 12:28:36 2017 -0700 +++ b/globalneighbors/web.py Sun Jun 25 12:54:05 2017 -0700 @@ -10,6 +10,8 @@ import os import sys import time +from paste import httpserver +from paste.urlparser import StaticURLParser from webob import Request, Response, exc from wsgiref import simple_server from .locations import locations @@ -163,17 +165,15 @@ # instantiate WSGI handler app = GlobalHandler(datafile=options.cities) - # serve it (Warning! Single threaded!) - server = simple_server.make_server(host='0.0.0.0', - port=options.port, - app=app) + # wrap it in a static file server + app = PassthroughFileserver(app) + + print ("Serving on http://{hostname}:{port}/".format(**options.__dict__)) try: - print ("Serving on http://{hostname}:{port}/".format(**options.__dict__)) - server.serve_forever() + httpserver.serve(app, host='0.0.0.0', port=options.port) except KeyboardInterrupt: pass if __name__ == '__main__': main() -