google-app-engine - google app engine - gcloud appengine go1.11: cannot serve static files - answerstu - answerstu.com answerstu

google app engine - gcloud appengine go1.11: cannot serve static files

I have a go 1.11 app with following directory:

./language ./models ./system ./public ./public/templates ./public/templates/home ./public/templates/layouts ./public/templates/partials ./public/templates/partials/frontend ./public/assets ./public/assets/css ./public/assets/js ./public/assets/img ./public/assets/icon ./public/assets/fonts ./conf ./handlers

And my app.yaml:

runtime: go111

handlers:
- url: /favicon.ico
  static_files: favicon.ico
  upload: favicon.ico
  secure: always

- url: /((?:img|css|js|icon|fonts)/(.*))$
  static_files: public/assets/\1
  upload: public/assets/
  http_headers:
    X-Foo: bar
  secure: always

- url: ./*
  script: auto
  secure: always

Everything works locally with dev_appserver.py, but I get 404s for all my static assets once I deploy to AppEngine. Ideas?

1 Answer

  1. Oliver- Reply

    2019-11-14

    Try to add:

    - url: /static
      static_dir: public
    

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>