【发布时间】:2013-07-28 11:54:17
【问题描述】:
基本上我是谷歌应用引擎的新手,我有一个名为模板的文件夹,其中有几个文件:
index.php
result.php
request.php
但是,在 yaml.app 上,我只知道如何通过将 templates/index.php 设为默认页面来在本地运行服务器。
我的意思是当我去http://localhost:8080 时,这就是我所看到的。但是当我做http://localhost:8080/templates/index.php 时,它说找不到 404。
如何在我的应用程序内的任何目录中使用我想要的所有文件,这是我应该添加到我的 app.yaml 的某种规则吗?
这是当前使用的 app.yaml:
application: sympy-live-hrd
version: 38
runtime: python27
threadsafe: true
api_version: 1
libraries:
- name: numpy
version: latest
- name: matplotlib
version: latest
handlers:
- url: /static
static_dir: static
expiration: 1d
# cache-busting scheme
# request /static-(app version)/filename
- url: /static-[0-9]+/(.*)
static_files: static/\1
upload: static/(.*)
# if you're adding the shell to your own app, change this regex url to the URL
# endpoint where you want the shell to run, e.g. /shell . You'll also probably
# want to add login: admin to restrict to admins only.
- url: .*
script: shell.application
Shell.application 是一个 python 脚本,我编辑它以使用 templates/index.php 作为默认值
【问题讨论】:
-
我已经红了那个文档,但我仍然对如何实现它感到困惑。
-
对什么感到困惑?
-
关于 url 处理的工作原理,我将我当前的 app.yaml 添加到问题中。
-
如果文件在 templates 目录中,那么
static_dir应该是static_dir: templates。
标签: php python google-app-engine