changeset 11:d1b99c695511

remove obselete data
author Jeff Hammel <k0scist@gmail.com>
date Sun, 25 Jun 2017 12:54:05 -0700
parents 21ed15391e8a
children 6d89ea94930b
files README.txt convergence.csv globalneighbors/grid.py globalneighbors/templates/index.html globalneighbors/web.py tests/test_grid.py
diffstat 6 files changed, 16 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/README.txt	Sun Jun 25 12:28:36 2017 -0700
+++ b/README.txt	Sun Jun 25 12:54:05 2017 -0700
@@ -79,6 +79,9 @@
 A simple web application was developed using
 `gunicorn` (http://gunicorn.org/) as the server.
 
+`Paste` was used to create a pass-through fileserver.
+It's multi-threaded server also made testing easier.
+
 ##  Deployment notes
 
 - parallelism:  the distance calculation is done serially.  As such
--- a/convergence.csv	Sun Jun 25 12:28:36 2017 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-2000 97
-3000 144
-4000 192
-5000 239
-6000 286
-7000 332
-8000 378
-9000 424
-10000 469
-11000 515
-12000 560
-13000 604
-14000 647
-15000 691
-16000 733
-17000 776
-18000 819
-19000 861
-20000 903
-21000 944
-22000 985
-23000 1026
-24000 1066
-25000 1107
-26000 1147
-27000 1186
-28000 1226
-29000 1265
-30000 1304
-31000 1342
-32000 1380
-33000 1419
-34000 1456
-35000 1493
-36000 1530
-37000 1566
-38000 1600
-39000 1634
-40000 1668
-41000 1701
-42000 1733
-43000 1766
-44000 1798
-45000 1830
-46000 1861
-47000 1894
-48000 1925
-49000 1956
-50000 1987
-51000 2017
-52000 2047
--- a/globalneighbors/grid.py	Sun Jun 25 12:28:36 2017 -0700
+++ b/globalneighbors/grid.py	Sun Jun 25 12:54:05 2017 -0700
@@ -65,6 +65,8 @@
             geoids.update(self[ii,jj])
         return geoids
 
+
 class GriddedLocations(object):
 
-    def __init__(self, 
+    def __init__(self, locations):
+        raise NotImplementedError('TODO')
--- a/globalneighbors/templates/index.html	Sun Jun 25 12:28:36 2017 -0700
+++ b/globalneighbors/templates/index.html	Sun Jun 25 12:54:05 2017 -0700
@@ -14,6 +14,7 @@
       });
       });
     </script>
+    <link rel="stylesheet" type="text/css" href="/css/style.css"/>
   </head>
   <body>
     <h1>Global Neighbors</h1>
--- 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()
-
--- a/tests/test_grid.py	Sun Jun 25 12:28:36 2017 -0700
+++ b/tests/test_grid.py	Sun Jun 25 12:54:05 2017 -0700
@@ -52,7 +52,7 @@
         assert os.path.exists(filename)
         with open(filename) as f:
             city_locations = locations(read_cities(f))
-        self.grid_locations(city_locations)
+        grid = self.grid_locations(city_locations)
 
     def test_neighbors(self):
         """test grid neighbor indexing"""
@@ -85,7 +85,7 @@
                 n_locations += len(grid[(i,j)])
         assert n_locations == len(locations)
 
-
+        return grid
 
 if __name__ == '__main__':
     unittest.main()