27
27
#### added by justin for EB
28
28
#from wsgiref.simple_server import make_server
29
29
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" ]} })
32
32
33
33
LOG = logging .getLogger (__name__ )
34
34
# logging.basicConfig(level=logging.INFO)
@@ -253,24 +253,24 @@ def _get_json_for_date_range(start_date, end_date, use_concept_tags, thumbs):
253
253
# Endpoints
254
254
#
255
255
256
- @application .route ('/' )
256
+ @app .route ('/' )
257
257
def home ():
258
258
return render_template ('home.html' , version = SERVICE_VERSION ,
259
259
service_url = request .host ,
260
260
methodname = APOD_METHOD_NAME ,
261
261
usage = _usage (joinstr = '", "' , prestr = '"' ) + '"' )
262
262
263
- @application .route ('/static/<asset_path>' )
263
+ @app .route ('/static/<asset_path>' )
264
264
def serve_static (asset_path ):
265
265
return current_app .send_static_file (asset_path )
266
266
267
267
268
- @application .route ('/' + SERVICE_VERSION + '/' + APOD_METHOD_NAME + '/' , methods = ['GET' ])
268
+ @app .route ('/' + SERVICE_VERSION + '/' + APOD_METHOD_NAME + '/' , methods = ['GET' ])
269
269
def apod ():
270
270
LOG .info ('apod path called' )
271
271
try :
272
272
273
- # application /json GET method
273
+ # app /json GET method
274
274
args = request .args
275
275
276
276
if not _validate (args ):
@@ -309,7 +309,7 @@ def apod():
309
309
return _abort (500 , 'Internal Service Error' , usage = False )
310
310
311
311
312
- @application .errorhandler (404 )
312
+ @app .errorhandler (404 )
313
313
def page_not_found (e ):
314
314
"""
315
315
Return a custom 404 error.
@@ -318,13 +318,13 @@ def page_not_found(e):
318
318
return _abort (404 , 'Sorry, Nothing at this URL.' , usage = True )
319
319
320
320
321
- @application .errorhandler (500 )
322
- def application_error (e ):
321
+ @app .errorhandler (500 )
322
+ def app_error (e ):
323
323
"""
324
324
Return a custom 500 error.
325
325
"""
326
326
return _abort (500 , 'Sorry, unexpected error: {}' .format (e ), usage = False )
327
327
328
328
329
329
if __name__ == '__main__' :
330
- application .run ('0.0.0.0' , port = 5000 )
330
+ app .run ('0.0.0.0' , port = 8000 )
0 commit comments