Google App Engine Python/Flask - Serving static folder from Google Cloud Storage

Viewed 521

I have deployed a website using Python and Flask on to Google App Engine successfully, but the performance seems to be pretty slow when first loading the page. I was reading that hosting some of the static files on Cloud Storage would possibly help with this, but I can not seem to get it to work. (www.example.com is just for illustration purposes)

Below is the app.yaml file:

runtime: python27
api_version: 1
threadsafe: true
automatic_scaling:
  max_idle_instances: 2

handlers:
- url: /.*
  script:  main.app

env_variables:
    CLOUD_STORAGE_BUCKET: www.example.com\static

builtins:
- deferred: on

I also created a Cloud Storage bucket named www.example.com with a static folder inside of it. I don't know if I need to change the url_for('static') in my jinja2 templates or what I need to do to fix this. I don't care to upload to the Cloud Storage just want to point my websites resources from there.

Any help is appreciated. By the way this is on Standard environment not flex.

0 Answers
Related