Google App Engine:app.yaml 文件有问题
Google App Engine: Issue with app.yaml file
我正在尝试将基于 HTML 的网站发布到我的 Google App Engine 服务。我没有为此项目使用任何 PHP 代码,因为它只是一个登录页面。
这是我的项目结构:
而且我认为我需要一个 app.yaml 文件来发布到 GAE? 这是我的 app.yaml 文件:
application: earthling-app
version: 1
runtime: php55
api_version: 1
handlers:
- url: /js
static_dir: js
- url: /images
static_dir: images
- url: /css
static_dir: css
但是,当我在 Google App Engine Launcher 中 运行 我的应用程序时,它显示如下:
我收到 "The url "/index.html“不匹配任何处理程序。”,'Not Found' 错误。
我的结构和 app.yaml 是否正确且安全地发布到 GAE 服务?为什么我看不到我的网站?
编辑
经过Amber的建议,这是我的app.yaml:
application: earthling-app
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
static_dir: static
然后我将所有静态文件移动到名为 'static'
的文件夹中
您定义了 3 个处理程序:/js
、/images
和 /css
。 None 个匹配 /index.html
,因此当您尝试访问包含 /index.html
的路径时,应用程序会抛出错误,因为它不知道该怎么做。
您需要定义一个或多个处理程序来匹配您要提供的实际页面,而不仅仅是 js/images/css 路径。
对于像您这样的完全静态的网站,最简单的方法可能是只定义一个处理程序:
handlers:
- url: /.*
static_dir: static
然后将您的整个网站(包括 css/images/js)放入 static
目录:
earthling/
app.yaml
static/
css/
...
images/
...
js/
...
index.html
favicon.ico
...
如果这样做,您甚至不需要任何 python 文件,因为整个网站将根据 static_dir 规则( /.*
匹配任何路径,因为 .*
匹配任何字符串)。
另一种方法是使用 Google Clould Storage 为您的网站提供服务。它具有为静态网站提供服务的功能。它用作 CDN,您只需为传输的数据付费。
我正在尝试将基于 HTML 的网站发布到我的 Google App Engine 服务。我没有为此项目使用任何 PHP 代码,因为它只是一个登录页面。
这是我的项目结构:
而且我认为我需要一个 app.yaml 文件来发布到 GAE? 这是我的 app.yaml 文件:
application: earthling-app
version: 1
runtime: php55
api_version: 1
handlers:
- url: /js
static_dir: js
- url: /images
static_dir: images
- url: /css
static_dir: css
但是,当我在 Google App Engine Launcher 中 运行 我的应用程序时,它显示如下:
我收到 "The url "/index.html“不匹配任何处理程序。”,'Not Found' 错误。
我的结构和 app.yaml 是否正确且安全地发布到 GAE 服务?为什么我看不到我的网站?
编辑
经过Amber的建议,这是我的app.yaml:
application: earthling-app
version: 1
runtime: python
api_version: 1
handlers:
- url: /.*
static_dir: static
然后我将所有静态文件移动到名为 'static'
的文件夹中您定义了 3 个处理程序:/js
、/images
和 /css
。 None 个匹配 /index.html
,因此当您尝试访问包含 /index.html
的路径时,应用程序会抛出错误,因为它不知道该怎么做。
您需要定义一个或多个处理程序来匹配您要提供的实际页面,而不仅仅是 js/images/css 路径。
对于像您这样的完全静态的网站,最简单的方法可能是只定义一个处理程序:
handlers:
- url: /.*
static_dir: static
然后将您的整个网站(包括 css/images/js)放入 static
目录:
earthling/
app.yaml
static/
css/
...
images/
...
js/
...
index.html
favicon.ico
...
如果这样做,您甚至不需要任何 python 文件,因为整个网站将根据 static_dir 规则( /.*
匹配任何路径,因为 .*
匹配任何字符串)。
另一种方法是使用 Google Clould Storage 为您的网站提供服务。它具有为静态网站提供服务的功能。它用作 CDN,您只需为传输的数据付费。