From 0ca733ecf8b938b7e9599e837e73abf2fe86612c Mon Sep 17 00:00:00 2001 From: Nick Date: Sat, 6 Apr 2019 14:38:35 -0600 Subject: [PATCH] error --- app.yaml | 7 ++++++- main.py | 8 ++++++++ requirements.txt | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/app.yaml b/app.yaml index 05e7714..2449010 100644 --- a/app.yaml +++ b/app.yaml @@ -1,5 +1,10 @@ runtime: python37 +instance_class: F4_1G +entrypoint: gunicorn -b :$PORT main:app +env: flex +threadsafe: yes + handlers: # This configures Google App Engine to serve the files in the app's static # directory. @@ -11,4 +16,4 @@ handlers: # the entire handlers section) when there are no static files defined. - url: /.* script: auto - instance_class: F4 + diff --git a/main.py b/main.py index 4ce749f..2ac430a 100644 --- a/main.py +++ b/main.py @@ -32,6 +32,14 @@ def root(): # For the sake of example, use static information to inflate the template. # This will be replaced with real information in later steps. return render_template('index.html') + +@app.errorhandler(500) +def server_error(e): + logging.exception('An error occurred during a request.') + return """ + An internal error occurred:
{}
+ See logs for full stacktrace. + """.format(e), 500 @app.route('/generate', methods=['POST']) diff --git a/requirements.txt b/requirements.txt index 23a794e..386522f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ regex==2017.4.5 numpy -tensorflow +tensorflow==1.13.1 flask - +gunicorn==19.7.1