You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 1, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+8-5Lines changed: 8 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Use of Google Cloud Platform (GCP) products & APIs is not free. While you may no
21
21
22
22
It's important to note that for App Engine (Standard), Python 2 is only supported as a first-generation ("Gen1") runtime whereas Python3 is only supported as a second-generation ("Gen2") runtime. This means that porting application from Python 2 to 3 also means migrating from Gen1 to Gen2 where things are different.
23
23
24
-
The most notable changes for developers are that bundled App Engine built-in services are absent from Gen2. The Gen1 bundled services have "grown-up" to become standalone products or have been deprecated. Gen2 also expects web apps to perform their own routing.
24
+
The most notable changes for developers are that bundled App Engine built-in services are absent from Gen2. The Gen1 bundled services have "grown-up" to become standalone products or have been deprecated. Gen2 also expects web apps to perform their own application (not network) routing.
25
25
26
26
> **NOTE:** App Engine ([Flexible](https://cloud.google.com/appengine/docs/flexible/python/runtime?hl=en#interpreter)) is a Gen2 service but is not within the scope of these tutorials. Developers who curious can compare App Engine [Standard vs. Flexible](https://cloud.google.com/appengine/docs/the-appengine-environments).
27
27
@@ -33,7 +33,7 @@ The sample app does not address complexities in your apps but serves as a guide
33
33
34
34
> **NOTE:**
35
35
> 1. It is also possible your app does not have a user interface, i.e., mobile backends, etc., so migrating the web framework (step 1) can be skipped.
36
-
> 1. Users interested in bringing back their dead apps that originally ran on the [deprecated Python 2.5 runtime](http://googleappengine.blogspot.com/2013/03/python-25-thanks-for-good-times.html) (shutdown in 2017) need to [migrate from `db` to `ndb`](http://cloud.google.com/appengine/docs/standard/python/ndb/db_to_ndb) before attempting this tutorial.
36
+
> 1. Users interested in bringing back their dead apps that originally ran on the [deprecated Python 2.5 runtime](http://googleappengine.blogspot.com/2013/03/python-25-thanks-for-good-times.html) (shutdown in 2017) need to [migrate from `db` to `ndb`](http://cloud.google.com/appengine/docs/standard/python/ndb/db_to_ndb) before attempting the techniques shown in this tutorial.
37
37
38
38
As mentioned above, some steps are more critical while others are *optional*. We recommend incremental updates. We designed each step to be relatively easy, so you experience each migration individually. However, there are some of you for whom the migration process may be easier where you may be able to take larger migration leaps.
39
39
@@ -44,18 +44,21 @@ We suggest considering where you want to end up eventually, playing with each mi
44
44
Each of the migration steps have their own codelabs & corresponding overview videos:
45
45
46
46
1. Migrate from `webapp2` to Flask
47
-
-Recommended if you have a web UI
47
+
-Stongly recommended if you have a web UI
48
48
- You can use another web framework as long as it supports routing
49
49
1. Migrate from App Engine NDB to Cloud NDB
50
50
- Stongly recommended
51
51
- Can migrate from Python 2 to 3 after this step
52
52
- Can migrate directly to Cloud Run after this step (see Step "2a" below)
53
53
- Remaining datastore migration steps optional
54
54
1. Migrate from Cloud NDB to Cloud Datastore
55
-
- Recommended if you have non-App Engine code accessing Cloud Datastore
55
+
- Cloud NDB works on both Python 2 & 3 App Engine runtimes (old & new), so it is optional
56
+
- Recommended if already using Cloud Datastore in other (App Engine *and* non-App Engine) apps & want a consistent/reusable codebase plus reduce maintenance costs
57
+
- If all you have are App Engine apps using Cloud NDB, there's no need to do this migration
56
58
1. Migrate from Cloud Datastore to (native) Cloud Firestore
57
-
-Recommended if you have mobile apps using Firebase+Cloud Firestore
59
+
-If your app (Cloud project) uses Datastore, you cannot use Firestore.
58
60
- Requires new project as Cloud Datastore & Cloud Firestore mutually-exclusive
61
+
- Most developers will NOT do this migration unless you *must have* Firestore's Firebase features
59
62
1. Migrate from App Engine to Cloud Run (using Cloud Datastore)
60
63
- Migrate your app to a container with Docker
61
64
- Alternative container migration with Buildpacks (see Step "5a" below)
! <li>{{ visit.timestamp.ctime }} from {{ visit.visitor }}</li>
271
-
{% endfor %}
272
-
</ul>
273
-
274
-
--- 8,14 ----
275
-
<h3>Last 10 visits</h3>
276
-
<ul>
277
-
{% for visit in visits %}
278
-
! <li>{{ visit.timestamp.ctime() }} from {{ visit.visitor }}</li>
279
-
{% endfor %}
280
-
</ul>
205
+
## Next
281
206
282
207
In the next step, we will migrate from App Engine NDB to Google Cloud NDB, a key step because after you complete *that*, you can either stop there or be presented with a variety of options to choose from.
Copy file name to clipboardExpand all lines: step2-flask-cloudndb-py2/README.md
+2-89Lines changed: 2 additions & 89 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ App Engine services have blossomed into their own products, and App Engine's Dat
18
18
1. Update `requirements.txt` to include the Cloud NDB library (`google-cloud-ndb`).
19
19
1. Update `app.yaml` to reference a pair of 3rd-party bundled packages: `grpcio` and `setuptools`
20
20
1. Update `appengine_config.py` to use the `pkg_resources` tool (which comes with `setuptools`) so App Engine can access [3rd-party libraries already available on Google servers](https://cloud.google.com/appengine/docs/standard/python/tools/built-in-libraries-27) so users don't have to list them in `requirements.txt` nor `pip install` them.
21
+
1. Similarly, [gRPC](http://grpc.io) is used by all [*Google Cloud* client libraries](https://cloud.google.com/apis/docs/cloud-client-libraries), and `grpcio` is the gRPC package for Python and thus required.
21
22
1. Switch application code to use the Cloud NDB client library
22
23
23
24
### Configuration
@@ -155,95 +156,7 @@ def fetch_visits(limit):
155
156
156
157
---
157
158
158
-
## Summary
159
-
160
-
For this migration step, here are the contextual `diff`s:
Copy file name to clipboardExpand all lines: step2-flask-cloudndb-py3/README.md
+2-32Lines changed: 2 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Introduction
4
4
5
-
We recommend developers migrate to Python 3 to access the latest App Engine runtimes & features. Developers can make this migration as soon as they've migrated to Cloud NDB (now). However since this is a large undertaking, you can move to Py3 after any of the datastore migration steps, not just this one. One of the outstanding features of the App Engine second generation runtimes (Gen2) is that neither "vendored" nor bundled 3rd-party packages are required to be uploaded to the service. They are automatically installed directly from `requirements.txt`.
5
+
We recommend developers migrate to Python 3 to access the latest App Engine runtimes & features. Developers can make this migration as soon as they've migrated to Cloud NDB (now). However since this can be a large undertaking, you can move to Py3 after any of the datastore migration steps, not just this one. One of the outstanding features of the App Engine second generation runtimes (Gen2) is that neither "vendored" nor bundled 3rd-party packages are required to be uploaded to the service. They are automatically installed directly from `requirements.txt`.
6
6
7
7
---
8
8
@@ -31,37 +31,7 @@ handlers:
31
31
32
32
---
33
33
34
-
## Summary
35
-
36
-
For the sample app in this tutorial, the overall contextual set of `diff`s (skipping this `README.md` and nonessential files) looks like this:
0 commit comments