I have had all my websites on App Engine working great for years and I recently got an email saying everything I used was deprecated. I'm migrating webapp to flask, etc etc.
My new server works locally (finally there were just a few code changes) however the deployed version does NOT work.
Locally I have the cloud SDK installed and /usr/local/google_appengine/lib/:/usr/local/google_appengine
in my PYTHONPATH
.
I import
from google.appengine.api import urlfetch
from google.appengine.api import datastore
from google.appengine.api import memcache
from google.appengine.ext import db
What requirements.txt am I missing? I tried to add the following
google-api-python-client==1.7.10
google-cloud-storage==1.6.0
googleapis-common-protos==1.6.0
google-cloud-datastore==1.8.0
but I'm still getting errors in the deployed app: ModuleNotFound google.appengine
. Also is there a generic way to go from google doc code example/import -> requirement? Thanks
This is not a complete answer but a good start:
I had to migrate db to ndb https://cloud.google.com/appengine/docs/standard/python/ndb/db_to_ndb
this seems to necessitate to set up iam permissions https://console.cloud.google.com/iam-admin/iam?project=yourproject
The migration is not so hard, mostly replacing db with ndb, changing repeated fields (a find and replace in the code, no datastore change). You also need to change the syntax of a few queries, this is a bit more laborious.
Regarding the "deprecated apis":
from google.appengine.api import datastore
became from google.cloud import datastore
And I had to use in requirements.txt:
google-api-python-client==1.7.10
google-cloud-ndb==0.0.1
google-cloud-storage==1.17.0
grpcio-gcp==1.17.1
There are a few things that I didn't bother migrating (especially since my website is not using them that much): google oauth and memcache.
I just removed my admin page (that was using oauth), and I replaced memcache with cachetools.LRUCache
(I used memcache to rate limit the calls on a page). Not as glamorous as a distributed cache but I didn't want to set up redis etc
End of the story: it is working locally but still not working when I deploy. After removing everything to just have a minimal website, it is still not working (while another project works) so I opened https://issuetracker.google.com/issues/138887166