Skip to content

Instantly share code, notes, and snippets.

@barrachri
Created November 24, 2019 18:41
Show Gist options
  • Save barrachri/8a493ec0d92342406b4ed256e9d2ba43 to your computer and use it in GitHub Desktop.
Save barrachri/8a493ec0d92342406b4ed256e9d2ba43 to your computer and use it in GitHub Desktop.
Python application
######### Cloud Run
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
target = os.environ.get('TARGET', 'World')
return 'Hello {}!\n'.format(target)
if __name__ == "__main__":
app.run(debug=False, host='0.0.0.0', port=int(os.environ.get('PORT', 8080)))
######### Cloud Function
import os
def hello_world(request):
target = os.environ.get('TARGET', 'World')
return 'Hello {}!\n'.format(target)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment