Google App Engine静态文件GET 404 [英] Google App Engine Static Files GET 404
问题描述
以下app.yaml在我的本地开发服务器上效果很好..但是当我将其部署到生产环境时,所有静态文件都会抛出404错误。服务器无法找到任何静态文件。一直在寻找小时找不到有效的解决方案。
注意:我正在使用mac进行开发,因此了解系统的区分大小写的性质。
<$ p $应用程序:dev-scanner
版本:1
运行时:python
api_version:1
处理程序:
- url :/(.+)
static_files:static_files / \ 1
upload:./static_files/(.+)
- url:/
static_files:static_files /index.html
上传:./static_files/index.html
这是错误from the log
$ b
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,如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.1404 0 - Mozilla /5.0
(Macintosh; U; Intel Mac OS X 10_6_6;
en-US)AppleWebKit / 534.16(KHTML,如
Gecko)Chrome / 10.0.64 8.134
Safari / 534.16,gzip(gfe),gzip(gfe),gzip(gfe)
dev.app-scanner.comms = 21 cpu_ms = 0
api_cpu_ms = 0 cpm_usd = 0.000053 W
2011-03-18 01:18:07.012静态文件
被处理程序引用未找到:
static_files / index.html
下面是使用 appcfg.py download_app -A
$ b后的文件系统结构$ b
在这个要点中看看app.yaml:
https://gist.github.com/873098
它成功地为静态网站提供服务。我看到的主要区别在于缺少上面提到的@Wooble所指的'./',并且使用(。*)而不是(。+)作为主要的正则表达式。 (。+)应该在理论上起作用。
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. 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.
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
Here is the file system structure after I use appcfg.py download_app -A
Take a look at the app.yaml in this gist:
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. (.+) should work in theory though.
这篇关于Google App Engine静态文件GET 404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!