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
28 lines (21 loc) · 668 Bytes
/
app.py
File metadata and controls
28 lines (21 loc) · 668 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
25
26
27
28
"""
A sample Hello World server.
"""
import os
from flask import Flask, render_template
# pylint: disable=C0103
app = Flask(__name__)
@app.route('/')
def hello():
"""Return a friendly HTTP greeting."""
message = "It's running!"
"""Get Cloud Run environment variables."""
service = os.environ.get('K_SERVICE', 'Unknown service')
revision = os.environ.get('K_REVISION', 'Unknown revision')
return render_template('index.html',
message=message,
Service=service,
Revision=revision)
if __name__ == '__main__':
server_port = os.environ.get('PORT', '8080')
app.run(debug=False, port=server_port, host='0.0.0.0')