Skip to content

Commit 816507b

Browse files
engelkedinagraves
andauthored
Update Appengine samples to python39 (GoogleCloudPlatform#5071)
* hello-world updated to python3.9 * pubsub sample updated to Python 3.9 * Added warmup sample to py 3.9 update * Updated bigquery sample to python 3.9 * Update cloudsql sample to py 39 * Updated custom server sample to py39 * Updated django sample to py39 * Updated redis sample to py39 * Updated spanner sample to py39 * Updated building-an-app sample to py39 * Updated migration/urlfetch sample to py39 * Added gae_python3_ tags in addition to gae_python38_ ones Co-authored-by: Dina Graves Portman <dinagraves@google.com>
1 parent 7b21f01 commit 816507b

36 files changed

Lines changed: 86 additions & 17 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
runtime: python38
1+
runtime: python39

appengine/standard_python3/bigquery/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
# [START gae_python38_bigquery]
16+
# [START gae_python3_bigquery]
1617
import concurrent.futures
1718

1819
import flask
@@ -75,4 +76,5 @@ def results():
7576
# Engine, a webserver process such as Gunicorn will serve the app. This
7677
# can be configured by adding an `entrypoint` to app.yaml.
7778
app.run(host="127.0.0.1", port=8080, debug=True)
79+
# [END gae_python3_bigquery]
7880
# [END gae_python38_bigquery]

appengine/standard_python3/building-an-app/building-an-app-1/app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
runtime: python38
1+
runtime: python39
22

33
handlers:
44
# This configures Google App Engine to serve the files in the app's static

appengine/standard_python3/building-an-app/building-an-app-1/main.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# limitations under the License.
1414

1515
# [START gae_python38_render_template]
16+
# [START gae_python3_render_template]
1617
import datetime
1718

1819
from flask import Flask, render_template
@@ -41,4 +42,5 @@ def root():
4142
# http://flask.pocoo.org/docs/1.0/quickstart/#static-files. Once deployed,
4243
# App Engine itself will serve those files as configured in app.yaml.
4344
app.run(host='127.0.0.1', port=8080, debug=True)
45+
# [END gae_python3_render_template]
4446
# [END gae_python38_render_template]

appengine/standard_python3/building-an-app/building-an-app-1/static/script.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
*/
1515

1616
// [START gae_python38_log]
17+
// [START gae_python3_log]
1718
'use strict';
1819

1920
window.addEventListener('load', function () {
2021

2122
console.log("Hello World!");
2223

2324
});
25+
// [END gae_python3_log]
2426
// [END gae_python38_log]

appengine/standard_python3/building-an-app/building-an-app-2/app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
runtime: python38
1+
runtime: python39
22

33
handlers:
44
# This configures Google App Engine to serve the files in the app's static

appengine/standard_python3/building-an-app/building-an-app-2/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@
1717
from flask import Flask, render_template
1818

1919
# [START gae_python38_datastore_store_and_fetch_times]
20+
# [START gae_python3_datastore_store_and_fetch_times]
2021
from google.cloud import datastore
2122

2223
datastore_client = datastore.Client()
2324

25+
# [END gae_python3_datastore_store_and_fetch_times]
2426
# [END gae_python38_datastore_store_and_fetch_times]
2527
app = Flask(__name__)
2628

2729

2830
# [START gae_python38_datastore_store_and_fetch_times]
31+
# [START gae_python3_datastore_store_and_fetch_times]
2932
def store_time(dt):
3033
entity = datastore.Entity(key=datastore_client.key('visit'))
3134
entity.update({
@@ -42,10 +45,12 @@ def fetch_times(limit):
4245
times = query.fetch(limit=limit)
4346

4447
return times
48+
# [END gae_python3_datastore_store_and_fetch_times]
4549
# [END gae_python38_datastore_store_and_fetch_times]
4650

4751

4852
# [START gae_python38_datastore_render_times]
53+
# [START gae_python3_datastore_render_times]
4954
@app.route('/')
5055
def root():
5156
# Store the current access time in Datastore.
@@ -56,6 +61,7 @@ def root():
5661

5762
return render_template(
5863
'index.html', times=times)
64+
# [END gae_python3_datastore_render_times]
5965
# [END gae_python38_datastore_render_times]
6066

6167

appengine/standard_python3/building-an-app/building-an-app-2/static/script.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@
1414
*/
1515

1616
// [START gae_python38_log]
17+
// [START gae_python3_log]
1718
'use strict';
1819

1920
window.addEventListener('load', function () {
2021

2122
console.log("Hello World!");
2223

2324
});
25+
// [END gae_python3_log]
2426
// [END gae_python38_log]

appengine/standard_python3/building-an-app/building-an-app-2/templates/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99

1010
<h1>Datastore and Firebase Auth Example</h1>
1111
<!-- [START gae_python38_datastore_print_times] -->
12+
<!-- [START gae_python3_datastore_print_times] -->
1213
<h2>Last 10 visits</h2>
1314
{% for time in times %}
1415
<p>{{ time['timestamp'] }}</p>
1516
{% endfor %}
17+
<!-- [END gae_python3_datastore_print_times] -->
1618
<!-- [END gae_python38_datastore_print_times] -->
1719
</body>
1820
</html>

appengine/standard_python3/building-an-app/building-an-app-3/app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
runtime: python38
1+
runtime: python39
22

33
handlers:
44
# This configures Google App Engine to serve the files in the app's static

0 commit comments

Comments
 (0)