Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f3e079e

Browse filesBrowse files
committed
Merge branch 'master' into entity_rename
2 parents 3ebda70 + 44d58cd commit f3e079e
Copy full SHA for f3e079e

File tree

Expand file treeCollapse file tree

2 files changed

+21
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+21
-0
lines changed

‎appengine/flexible/hello_world/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/hello_world/main.py
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# limitations under the License.
1414

1515
# [START app]
16+
import logging
17+
1618
from flask import Flask
1719

1820

@@ -25,6 +27,14 @@ def hello():
2527
return 'Hello World!'
2628

2729

30+
@app.errorhandler(500)
31+
def server_error(e):
32+
logging.exception('An error occurred during a request.')
33+
return """
34+
An internal error occurred: <pre>{}</pre>
35+
See logs for full stacktrace.
36+
""".format(e), 500
37+
2838
if __name__ == '__main__':
2939
# This is used when running locally. Gunicorn is used to run the
3040
# application on Google App Engine. See entrypoint in app.yaml.

‎appengine/flexible/hello_world_compat/main.py

Copy file name to clipboardExpand all lines: appengine/flexible/hello_world_compat/main.py
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# limitations under the License.
1414

1515
# [START app]
16+
import logging
17+
1618
from flask import Flask
1719

1820

@@ -23,4 +25,13 @@
2325
def hello():
2426
"""Return a friendly HTTP greeting."""
2527
return 'Hello World!'
28+
29+
30+
@app.errorhandler(500)
31+
def server_error(e):
32+
logging.exception('An error occurred during a request.')
33+
return """
34+
An internal error occurred: <pre>{}</pre>
35+
See logs for full stacktrace.
36+
""".format(e), 500
2637
# [END app]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.