1

I'm expecting if I share files publicly from Google Cloud Storage bucket, then there is a way to create a route handler in app.yaml that maps to the content in the GCS bucket. The examples I've seen so far from Google only show ways that involve writing code.

https://cloud.google.com/appengine/docs/standard/python/googlecloudstorageclient/app-engine-cloud-storage-sample

Is there an example app.yaml where this just works without writing code other than config inside appy.yaml?

JL-HaiNan
  • 884
  • 8
  • 18
Darian311
  • 764
  • 7
  • 20

1 Answers1

2

No, I don't think that is possible.

To serve content without writing code means to serve static content. And the only way to configure such static content is via the static_dir or static_files statements in the Handlers element of the app.yaml configuration file. Which means that content is deployed/uploaded with your application code and won't be stored in a GCS location accessible in the usual/standard way.

There is a way to serve static content directly from GCS, but it's not configured via the GAE app.yaml file, it's configured as part of the bucket configuration in GCS, see the Hosting a Static Website guide.

You could just reference by url such resources in your app, but it may be tricky/impossible to make them appear to be served from the same subdomain, see Is it possible to serve static files on Google Cloud Storage with Google App Engine with one domain?

Community
  • 1
  • 1
Dan Cornilescu
  • 37,297
  • 11
  • 54
  • 89
  • 1
    Ok, then I'll have to make this a feature request. All google cloud projects now have a default storage bucket, so it makes sense to serve content from there without having to set up cross domain javascript or set up python code to proxy the content server side. – Darian311 Apr 23 '17 at 20:03