How to link static folder in Google app engine with a storage bucket

Tags: , , ,



Created a new python Flask app-engine python project and want to use the static files from Google cloud storage. I am using this yaml.file:

runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:app

runtime_config:
  python_version: 3

Where in the app engine do you link to storage https://storage.googleapis.com/<your-bucket-name>/static/ with /static in the app-engine? It is not clear from the documentation.

Answer

You can’t use file stored on Google Cloud Storage as static folder in your App Engine environment. The solution proposed by the documentation is to have 2 sources (2 URL): one for the static file on GCS, the other for the backend on App Engine Flex.

The main issue with this design is the CORS issues. Personally I prefer another design.



Source: stackoverflow