jueves, 21 de enero de 2021

Deploying cp100-bookshelf on GCP App Engine (sample Python bookshelf app)

In Google Cloud Shell, using Python 2 (the version I get in app.yml, runtime: python27)

mkdir src

cd src git clone https://github.com/GoogleCloudPlatformTraining/cp100-bookshelf.git

Edit cloud-storage/bookshelf/storage.py line 20, change


from werkzeug import secure_filename


to


from werkzeug.utils import secure_filename


Otherwise, you'll get:


ImportError: cannot import name secure_filename

at

<module> (/base/data/home/apps/.../bookshelf/storage.py:20)


Then:


cd cloud-storage

pip install -t lib -r requirements.txt

gcloud app deploy


cd app-engine

pip install -t lib -r requirements.txt

gcloud app deploy




If you don't pip install requirements, you'll get something like:

ValueError: virtualenv: cannot access lib: No such virtualenv or site directory
at add (/base/alloc/tmpfs/dynamic_runtimes/python27g/.../python27/python27_lib/versions/1/google/appengine/ext/vendor/__init__.py:44)


No hay comentarios: