Mercurial > hg > GlobalNeighbors
comparison wsgiapp.py @ 19:811adc9736eb
add configuration for gunicorn
| author | Jeff Hammel <k0scist@gmail.com> |
|---|---|
| date | Sun, 25 Jun 2017 15:43:45 -0700 |
| parents | 5dba84370182 |
| children | 6891c5523b69 |
comparison
equal
deleted
inserted
replaced
| 18:87ae70245201 | 19:811adc9736eb |
|---|---|
| 1 """ | 1 """ |
| 2 WSGI app as appropriate for gunicorn | 2 WSGI app as appropriate for gunicorn |
| 3 """ | 3 """ |
| 4 | 4 |
| 5 import os | 5 import os |
| 6 import sys | |
| 6 from globalneighbors.web import GlobalHandler | 7 from globalneighbors.web import GlobalHandler |
| 8 from globalneighbors.web import PassthroughFileserver | |
| 7 | 9 |
| 8 # paths | 10 # paths |
| 9 here = os.path.dirname(os.path.abspath(__file__)) | 11 here = os.path.dirname(os.path.abspath(__file__)) |
| 10 data = os.path.join(here, 'data') | 12 print ("You are here: {}".format(here)) |
| 11 cities1000 = os.path.join(data, 'cities1000.txt') | 13 cities1000 = os.environ.get("CITIES1000") |
| 14 if not cities1000: | |
| 15 # XXX use a default not really appropriate for production | |
| 16 cities1000 = os.path.join(here, 'tests', 'data', 'cities1000.txt') | |
| 17 assert os.path.exists(cities1000) | |
| 12 | 18 |
| 13 # WSGI App | 19 # WSGI App |
| 14 app = GlobalHandler(cities1000) | 20 application = PassthroughFileserver(GlobalHandler(cities1000)) |
| 21 print ("Finished loading application") | |
| 22 sys.stdout.flush() |
