简体   繁体   English

Google app引擎静态文件处理程序示例

[英]Google app engine static file handlers example

The static_dir examples are pretty clear static_dir示例非常清楚

So for example, I want requests to http://mysite.appengine.com/main.htm to go to the C:\\<appenginesiteroot>\\html\\main.htm file (on the hard disk), and this can be achieved with 例如,我想要http://mysite.appengine.com/main.htm请求转到C:\\<appenginesiteroot>\\html\\main.htm文件(在硬盘上),这可以实现同

# app.yaml
- url: /
  static_dir: html

But when it comes to using static file handlers its not clear. 但是当谈到使用静态文件处理程序时,它并不清楚。

Specifically I want to map a URL to an html or other static file . 具体来说,我想将URL映射到html或其他静态文件

So for example, requests for http://mysite.appengine.com/ will send down main.htm . 例如,对http://mysite.appengine.com/请求将向下发送main.htm

- url: /
  script: main.htm ?? #fails because main.htm isn't a script file

I know it is possible using a directive like: 我知道可以使用如下指令:

- url: /
  script: main.py

Then having main.py simply send down html, but I'd like to know if "static file handlers" are really in GAE or if its just a hoax. 然后让main.py简单地发送html,但我想知道“静态文件处理程序”是否真的在GAE中,或者它只是一个骗局。

script is for scripts, you are trying to map to a static file. script用于脚本,您尝试映射到静态文件。 Have you looked at the Static File Pattern Handlers section of the doc? 你看过doc的静态文件模式处理程序部分了吗?

Have you tried: 你有没有尝试过:

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

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

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