[英]how to serve static files on google app engine
Basically I'm new to the google app engine, I have a folder called templates in which I have several files : 基本上我是google app引擎的新手,我有一个名为templates的文件夹,其中有几个文件:
index.php
result.php
request.php
However on the yaml.app I figured out only how to run the server locally by making the templates/index.php default page. 但是在yaml.app上我只想出了如何通过制作templates / index.php默认页面来本地运行服务器。 I mean when I go to
http://localhost:8080
it is what I see. 我的意思是当我去
http://localhost:8080
这就是我所看到的。 But when I do http://localhost:8080/templates/index.php
it says 404 not found. 但是,当我执行
http://localhost:8080/templates/index.php
它说404找不到。 How Can I use all the files I want in any directory inside my app, is it somekind of rule I should add to my app.yaml? 如何在我的应用程序内的任何目录中使用我想要的所有文件,是否应该添加到我的app.yaml中的某些规则?
Here is the current app.yaml im using : 这是当前的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
The Shell.application is a python script that I edited to use templates/index.php as default Shell.application是我编辑的python脚本,默认使用templates / index.php
I'm assuming index.php is a script? 我假设index.php是一个脚本?
I believe you have to run php scripts using the php runtime. 我相信你必须使用php运行时运行php脚本。 They won't run as scripts from the python runtime, so firstly, you won't be able to run the php scripts.
它们不会作为python运行时的脚本运行,所以首先,你将无法运行php脚本。
Second, you need a handler that will point to your templates folder, but that doesn't exist. 其次,您需要一个指向您的模板文件夹的处理程序,但这不存在。
handlers:
- url: /templates
static_dir: templates
expiration: 1d
Note that this will just load the file, it won't run php files unless you're using the php runtime. 请注意,这只会加载文件,除非您使用的是php运行时,否则它不会运行php文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.