forked from GoogleCloudPlatform/cloud-code-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
24 lines (17 loc) · 581 Bytes
/
app.py
File metadata and controls
24 lines (17 loc) · 581 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
from signal import signal, SIGINT
from flask import Flask, render_template
def handler(signal_received, frame):
# SIGINT or ctrl-C detected, exit without error
exit(0)
# pylint: disable=C0103
app = Flask(__name__)
@app.route('/')
def hello():
"""Return a simple HTML page with a friendly message."""
message = "It's running!"
return render_template('index.html', message=message)
if __name__ == '__main__':
signal(SIGINT, handler)
server_port = os.environ.get('PORT', '8080')
app.run(debug=False, port=server_port, host='0.0.0.0')