gcloud appengine go1.11:无法提供静态文件

时间:2018-12-24 16:41:36

标签: google-app-engine gcloud

我有一个带有以下目录的go 1.11应用程序:

./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

还有我的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

一切都在本地与dev_appserver.py一起使用,但是一旦部署到AppEngine,我的所有静态资产就会获得404。想法?

1 个答案:

答案 0 :(得分:1)

尝试添加:

- url: /static
  static_dir: public