【发布时间】:2017-02-02 10:25:28
【问题描述】:
我试图使用谷歌应用引擎云空间。我的程序在 localhost 中运行没有任何问题,但是当我尝试在 google app 引擎中托管它时,不提供静态文件。 app.yaml 如下:
application: myTestApp-nn34322
version: 1
runtime: go
threadsafe: true
api_version: go1
handlers:
- url: /static/css
static_dir: ../static/css
mime_type: "text/css"
- url: /static/js
static_dir: ../static/js
mime_type: "text/javascript"
- url: /static/images
static_dir: ../static/images
- url: /.*
script: _go_app
【问题讨论】:
-
在尝试获取静态文件时是否收到
HTTP 404错误?另外,app.yaml和static文件夹是否在同一个文件夹中? -
是的,我收到 404。我正在使用 beegae 框架。所以我的 app.yaml 在主文件夹中。我的静态文件夹与主文件夹一起位于根目录中。
-
我的感觉是您的
static文件夹没有上传到Appengine。尝试将static文件夹移动到app.yaml旁边,当然也可以使用:static_dir: static/xxx。 -
@icza 谢谢老兄。有效。如果您将此作为答案发布,那就太好了。
标签: google-app-engine go