Skip to content

Commit 7ebad54

Browse files
iennaenicain
andauthored
fix: add region tag, move code around for docs (GoogleCloudPlatform#9952)
* fix: add region tag, move code around for docs pair with @nicain; this is not typical usage of if __name__ == .. but to make sure documentation and intent of the sample for atlas this should work. Co-authored-by: Nick Cain <nicholascain@google.com> * Fix: linting Update main.py I deleted one too many empty lines. * fix: change debug to False * fix: remove old region tag that is no longer used * fix: standardize on server remote region tag server_setup * fix: bring back region tag process for changing the name for a region tag is to add the second one, update docs, then remove the old tag. So this requires both region tags currently. Second, remove the if statement. Even if this is not matching the intent of the other samples, this is the preferred method from @engelke * fix: remove os as no longer using it --------- Co-authored-by: Nick Cain <nicholascain@google.com>
1 parent 4c384df commit 7ebad54

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

run/pubsub/main.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
# limitations under the License.
1414

1515
# [START cloudrun_pubsub_server_setup]
16-
# [START run_pubsub_server_setup]
16+
# [START cloudrun_pubsub_server]
1717
import base64
18-
import os
1918

2019
from flask import Flask, request
2120

2221

2322
app = Flask(__name__)
24-
# [END run_pubsub_server_setup]
23+
2524
# [END cloudrun_pubsub_server_setup]
25+
# [END cloudrun_pubsub_server]
2626

2727

2828
# [START cloudrun_pubsub_handler]
@@ -53,11 +53,3 @@ def index():
5353

5454
# [END run_pubsub_handler]
5555
# [END cloudrun_pubsub_handler]
56-
57-
58-
if __name__ == "__main__":
59-
PORT = int(os.getenv("PORT")) if os.getenv("PORT") else 8080
60-
61-
# This is used when running locally. Gunicorn is used to run the
62-
# application on Cloud Run. See entrypoint in Dockerfile.
63-
app.run(host="127.0.0.1", port=PORT, debug=True)

0 commit comments

Comments
 (0)