【发布时间】:2017-08-08 16:52:08
【问题描述】:
我的 Python App Engine 网络应用程序的 app.yaml 设置遇到问题。不知何故,除了我的应用程序中的 index.html 其余静态文件(javascript、CSS 和 HTML)之外,我没有将它们部署到应用程序引擎中。我在app.yaml 的脚本下尝试了static_files 和upload 元素的各种组合。虽然其中一些在本地开发应用服务器上工作,但在通过gcloud app deploy 部署在应用引擎上时它们不工作。 gcloud 生成的日志没有显示任何错误。它们会为我的所有静态文件显示调试消息,例如“跳过 [...] 的上传”。
应用程序(它是一个AngularJS应用程序)的目录结构如下:
<APP ROOT>
├── app.yaml
├── my_scripts
│ ├── foo.py
│ └── ...
├── index.html
├── mainapp.py
└── web
├── assets
│ ├── css
│ │ ├── bootstrap.min.css
│ │ ├── bootstrap-theme.min.css
│ │ ├── ....
│ │ └── ....
│ └── js
│ ├── app
│ │ ├── app.js
│ │ └── ....
│ └── lib
│ └── ...
└── partials
├── login.html
└── ...
以下是我的应用程序的 app.yml 文件。
runtime: python27
api_version: 1
threadsafe: true
handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /(user|tasks)/.*
script: mainapp.app
- url: /
static_files: index.html
upload: index.html
- url: /web
static_files: web\/[^\n]*
upload: web\/[^\n]*
- url: /web
static_dir: web
任何能帮助我解决此问题的指针将不胜感激。
【问题讨论】:
-
看看stackoverflow.com/questions/33447890/static-files-are-missing/…。查看解决该问题是否有助于在部署期间跳过静态文件。顺便说一句 - 是否有理由跳过它们显示在任何地方?
标签: python file google-app-engine static app.yaml