2727#### added by justin for EB
2828#from wsgiref.simple_server import make_server
2929
30- application = Flask (__name__ )
31- CORS (application , resources = {r"/*" : {"expose_headers" : ["X-RateLimit-Limit" ,"X-RateLimit-Remaining" ]} })
30+ app = Flask (__name__ )
31+ CORS (app , resources = {r"/*" : {"expose_headers" : ["X-RateLimit-Limit" ,"X-RateLimit-Remaining" ]} })
3232
3333LOG = logging .getLogger (__name__ )
3434# logging.basicConfig(level=logging.INFO)
@@ -253,24 +253,24 @@ def _get_json_for_date_range(start_date, end_date, use_concept_tags, thumbs):
253253# Endpoints
254254#
255255
256- @application .route ('/' )
256+ @app .route ('/' )
257257def home ():
258258 return render_template ('home.html' , version = SERVICE_VERSION ,
259259 service_url = request .host ,
260260 methodname = APOD_METHOD_NAME ,
261261 usage = _usage (joinstr = '", "' , prestr = '"' ) + '"' )
262262
263- @application .route ('/static/<asset_path>' )
263+ @app .route ('/static/<asset_path>' )
264264def serve_static (asset_path ):
265265 return current_app .send_static_file (asset_path )
266266
267267
268- @application .route ('/' + SERVICE_VERSION + '/' + APOD_METHOD_NAME + '/' , methods = ['GET' ])
268+ @app .route ('/' + SERVICE_VERSION + '/' + APOD_METHOD_NAME + '/' , methods = ['GET' ])
269269def apod ():
270270 LOG .info ('apod path called' )
271271 try :
272272
273- # application /json GET method
273+ # app /json GET method
274274 args = request .args
275275
276276 if not _validate (args ):
@@ -309,7 +309,7 @@ def apod():
309309 return _abort (500 , 'Internal Service Error' , usage = False )
310310
311311
312- @application .errorhandler (404 )
312+ @app .errorhandler (404 )
313313def page_not_found (e ):
314314 """
315315 Return a custom 404 error.
@@ -318,13 +318,13 @@ def page_not_found(e):
318318 return _abort (404 , 'Sorry, Nothing at this URL.' , usage = True )
319319
320320
321- @application .errorhandler (500 )
322- def application_error (e ):
321+ @app .errorhandler (500 )
322+ def app_error (e ):
323323 """
324324 Return a custom 500 error.
325325 """
326326 return _abort (500 , 'Sorry, unexpected error: {}' .format (e ), usage = False )
327327
328328
329329if __name__ == '__main__' :
330- application .run ('0.0.0.0' , port = 5000 )
330+ app .run ('0.0.0.0' , port = 8000 )
0 commit comments