Skip to content

Commit e7bb0a4

Browse files
committed
updates to work with api hosting changes
1 parent 5f240b3 commit e7bb0a4

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

Procfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: gunicorn apod.service:app --log-file=-
1+
web: waitress-serve --port=8000 application:app

application.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
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

3333
LOG = 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('/')
257257
def 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>')
264264
def 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'])
269269
def 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)
313313
def 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

329329
if __name__ == '__main__':
330-
application.run('0.0.0.0', port=5000)
330+
app.run('0.0.0.0', port=8000)

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# Note: The `lib` directory is added to `sys.path` by `appengine_config.py`.
77
flask>=1.0.2
88
flask-cors>=3.0.7
9-
gunicorn==19.5.0
109
Jinja2>=2.8
1110
Werkzeug>=0.10.4
1211
beautifulsoup4==4.11.1
@@ -16,4 +15,5 @@ nose==1.3.7
1615
setupext-janitor==1.0.0
1716
bs4==0.0.1
1817
mock>=3.0.0
19-
Pillow>=9.3
18+
Pillow>=9.3
19+
waitress==2.1.2

0 commit comments

Comments
 (0)