4

これに関するチュートリアルはありますか? 私のプロジェクトには 3 つのファイルがあります。

  • index.html
  • index.css
  • index.js

単純なはずですが、これまでのところ、巨大な GAE のドキュメントで迷っています。

4

3 に答える 3

4

Markが示唆しているように、app.yamlで各ファイルを個別に呼び出す必要はありません。代わりに、このような単純なハンドラーで十分です。

application: myapp
version: main
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /(.*)/
  static_files: \1/index.html
  upload: .*/index.html
- url: /.*
  static_dir: static

次に、を含むディレクトリの下の「static」というディレクトリにサイトを配置しますapp.yaml

index.html最初のハンドラーは、誰かがディレクトリを要求するたびにそれが提供されることを保証します。2番目のハンドラーは、静的ディレクトリから直接他のすべてのURLを提供します。

于 2012-06-07T00:07:17.880 に答える
1

それが、Google がこのサービスを使用する目的であるとは考えていません。しかし、単純な静的コンテンツを本当に提供する必要がある場合。

次のようにapp.yamlファイルを定義します。

application: staticapp
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /
  static_files: index.html
  upload: index.html

- url: /index.css
  static_files: index.css
  upload: index.css

-url: /index.js
  static_files: index.js
  upload: index.js

次に使用appcfg update .します(ソースディレクトリでLinuxを使用していると仮定します)

于 2012-06-06T18:09:34.497 に答える