![](/img/trans.png)
[英]Google App Engine - serve php and static content from same directory
[英]how to serve static files on google app engine
基本上我是google app引擎的新手,我有一个名为templates的文件夹,其中有几个文件:
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
我假设index.php是一个脚本?
我相信你必须使用php运行时运行php脚本。 它们不会作为python运行时的脚本运行,所以首先,你将无法运行php脚本。
其次,您需要一个指向您的模板文件夹的处理程序,但这不存在。
handlers:
- url: /templates
static_dir: templates
expiration: 1d
请注意,这只会加载文件,除非您使用的是php运行时,否则它不会运行php文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.