# HG changeset patch # User Jeff Hammel # Date 1498430625 25200 # Node ID 811adc9736eb5997b8e3ad267b665e90e815d03a # Parent 87ae70245201f94896b1da8aa97dd820ce45f5c2 add configuration for gunicorn diff -r 87ae70245201 -r 811adc9736eb README.txt --- a/README.txt Sun Jun 25 15:13:29 2017 -0700 +++ b/README.txt Sun Jun 25 15:43:45 2017 -0700 @@ -82,6 +82,14 @@ `Paste` was used to create a pass-through fileserver. It's multi-threaded server also made testing easier. +For fun, each city page links to a google map with its +latitude and longitude. I found the secret decoder ring here: +http://asnsblues.blogspot.com/2011/11/google-maps-query-string-parameters.html + +The landing page gives an input box using jQuery's +http://easyautocomplete.com/ . + + ## Deployment notes `supervisor` (http://supervisord.org/) was used to ensure diff -r 87ae70245201 -r 811adc9736eb globalneighbors/distance.py --- a/globalneighbors/distance.py Sun Jun 25 15:13:29 2017 -0700 +++ b/globalneighbors/distance.py Sun Jun 25 15:43:45 2017 -0700 @@ -193,6 +193,8 @@ output=options.output_counter) # output + print ("Outputting neighbors") + sys.stdout.flush() options.output.write(json.dumps(neighbors)) if __name__ == '__main__': diff -r 87ae70245201 -r 811adc9736eb gunicorn.conf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gunicorn.conf Sun Jun 25 15:43:45 2017 -0700 @@ -0,0 +1,2 @@ +[program:globalneighbors] +command=/home/jhammel/GlobalNeighbors/bin/gunicorn -w 2 --chdir /home/jhammel/GlobalNeighbors/src/GlobalNeighbors -b 0.0.0.0:8080 wsgiapp:application \ No newline at end of file diff -r 87ae70245201 -r 811adc9736eb wsgiapp.py --- a/wsgiapp.py Sun Jun 25 15:13:29 2017 -0700 +++ b/wsgiapp.py Sun Jun 25 15:43:45 2017 -0700 @@ -3,12 +3,20 @@ """ import os +import sys from globalneighbors.web import GlobalHandler +from globalneighbors.web import PassthroughFileserver # paths here = os.path.dirname(os.path.abspath(__file__)) -data = os.path.join(here, 'data') -cities1000 = os.path.join(data, 'cities1000.txt') +print ("You are here: {}".format(here)) +cities1000 = os.environ.get("CITIES1000") +if not cities1000: + # XXX use a default not really appropriate for production + cities1000 = os.path.join(here, 'tests', 'data', 'cities1000.txt') +assert os.path.exists(cities1000) # WSGI App -app = GlobalHandler(cities1000) +application = PassthroughFileserver(GlobalHandler(cities1000)) +print ("Finished loading application") +sys.stdout.flush()