view wsgiapp.py @ 25:991bce6b6881 default tip

[knn] placeholder for planning session
author Jeff Hammel <k0scist@gmail.com>
date Sun, 17 Sep 2017 14:35:50 -0700
parents 6891c5523b69
children
line wrap: on
line source

"""
WSGI app as appropriate for gunicorn
"""

import os
import sys
from globalneighbors.web import GlobalHandler
from globalneighbors.web import PassthroughFileserver

# paths
here = os.path.dirname(os.path.abspath(__file__))
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)
neighbors = '/home/jhammel/GlobalNeighbors/neighbors.dat'
assert os.path.exists(neighbors)

# WSGI App
application = PassthroughFileserver(GlobalHandler(cities1000,
                                                  neighbors_file=neighbors))
print ("Finished loading application")
sys.stdout.flush()