简体   繁体   English

Google App Engine静态文件GET 404

[英]Google App Engine Static Files GET 404

The following app.yaml works great on my local dev server.. but when I deploy it to production all static files throw 404. Server isn't able to locate any static files. 以下app.yaml在我的本地开发服务器上工作得很好..但是当我将它部署到生产时,所有静态文件都抛出404.服务器无法找到任何静态文件。 Have been searching for hours couldn't find a valid solution. 一直在搜索几个小时找不到有效的解决方案。

Note: I am developing with mac, so aware of the case sensitive nature of the system. 注意:我正在使用mac进行开发,因此了解系统的区分大小写的特性。

application: dev-scanner
version: 1
runtime: python
api_version: 1

handlers:
- url: /(.+)
  static_files: static_files/\1
  upload: ./static_files/(.+)

- url: /
  static_files: static_files/index.html
  upload: ./static_files/index.html

Here is the error from the log 这是日志中的错误

2011-03-18 01:18:07.033 / 404 21ms 0cpu_ms 0kb Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.134 Safari/534.16,gzip(gfe),gzip(gfe),gzip(gfe) 76.126.174.202 - - [18/Mar/2011:01:18:07 -0700] "GET / HTTP/1.1" 404 0 - "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_6; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.134 Safari/534.16,gzip(gfe),gzip(gfe),gzip(gfe)" "dev.app-scanner.com" ms=21 cpu_ms=0 api_cpu_ms=0 cpm_usd=0.000053 W 2011-03-18 01:18:07.012 Static file referenced by handler not found: static_files/index.html 2011-03-18 01:18:07.033 / 404 21ms 0cpu_ms 0kb Mozilla / 5.0(Macintosh; U; Intel Mac OS X 10_6_6; zh-CN)AppleWebKit / 534.16(KHTML,与Gecko一样)Chrome / 10.0.648.134 Safari / 534.16 ,gzip(gfe),gzip(gfe),gzip(gfe)76.126.174.202 - - [18 / Mar / 2011:01:18:07 -0700]“GET / HTTP / 1.1”404 0 - “Mozilla / 5.0( Macintosh; U; Intel Mac OS X 10_6_6; zh-CN)AppleWebKit / 534.16(KHTML,与Gecko一样)Chrome / 10.0.648.134 Safari / 534.16,gzip(gfe),gzip(gfe),gzip(gfe)“”dev。 app-scanner.com“ms = 21 cpu_ms = 0 api_cpu_ms = 0 cpm_usd = 0.000053 W 2011-03-18 01:18:07.012未找到处理程序引用的静态文件:static_files / index.html

Here is the file system structure after I use appcfg.py download_app -A 这是我使用appcfg.py download_app -A后的文件系统结构

在此输入图像描述

Take a look at the app.yaml in this gist: 看看这个要点中的app.yaml:

https://gist.github.com/873098 https://gist.github.com/873098

It successfully serves a static site. 它成功地为静态站点提供服务。 The main differences I see are the lack of the './' as noted by @Wooble above, and the use of (.*) instead of (.+) as the main regular expression. 我看到的主要区别是缺少上面@Wooble所指出的'./',而使用(。*)代替(。+)作为主正则表达式。 (.+) should work in theory though. (。+)应该在理论上有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM