I am trying to migrate an application from the google app engine standard environment first generation(python 2.7 runtimes) to second-generation ( python 3 runtimes).
The application serves the user-specific images stored in google cloud storage(previously blob storage). I have completed most of the migration as mentioned in the migration guide provided by Google.
I am facing the following challenges:
- I am not able to find any specific way of creating
blob keyfor blobs stored in google cloud storage. In the previous generation, I could usecreate_gs_keybut that functionality seems removed. - Old application has stored image detail in the form of
ndb.BlobKeyProperty()how I can migrate these to cloud storage and retain the information. For the previous generation, I could use theGoogleAppEngineCloudStorageClientlibrary.
Current stack:
- google app engine : python 3 runtime, flask HTML, jquery, javascript
Old stack:
- google app engine : python 2.7 runtime, webapp2, HTML, jquery, javascript
Disclaimer:
- Google does provide the option to use app engine APIs in python 3 runtimes by enabling
appengine apisin app.yaml but it seems this functionality might be removed at any time. - I do not want to keep the application permanently on python 2.7 using docker.
- Apart from
images API, I am not using any other legacy google app engine service.
I might have missed something so feel free to correct me.
EDIT 1:
As mentioned, I have an old application that has
blob_keyindicating the blob key for stored images, if in the current version I have to use thefile namedirectly I will have to either migrate the images stored in the form of blob key to google cloud storage, make changes to the model( I am trying to avoid this unless and until I don't have any other option)If I understand correctly,
google.appengine.api.blobstore.blobstoreis deprecated and usingblob storemethods is discouraged(Correct me if I am wrong).
I've been through almost the same problem: My GAE app was written with python2.7 and the API for that which was deprecated. What I did was create a completely new app with python3 and Flask, giving it the public api endpoint
api.{{my domain}}.com. When a request comes for the images of an item, I invoke the legacy python2.7 version of my app and write it back to the new one. It isn't elegant but it was the best that I could do.