Mercurial > hg > GlobalNeighbors
changeset 19:811adc9736eb
add configuration for gunicorn
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Sun, 25 Jun 2017 15:43:45 -0700 |
parents | 87ae70245201 |
children | 2fef925fbf37 |
files | README.txt globalneighbors/distance.py gunicorn.conf wsgiapp.py |
diffstat | 4 files changed, 23 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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__':
--- /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
--- 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()