4

私は App Engine フレキシブル環境 (以前はマネージド VM と呼ばれていました) を使用しており、最近最新の gcloud SDK にアップグレードしました。いくつかの新しいエラーが含まれていました:

ERROR: (gcloud.preview.app.deploy) Error Response: [400] Invalid
character
in filename: lib/setuptools/script (dev).tmpl

ERROR: The [application] field is specified in file [.../app.yaml]. This field is not used
by gcloud and must be removed. Project name should instead be
specified either by `gcloud config set project MY_PROJECT` or by
setting the `--project` flag on individual command executions.

ERROR: (gcloud.preview.app.deploy) There is a Dockerfile in the
current directory, and the runtime field in
.../app.yaml is currently set to
[runtime: python27]. To use your Dockerfile to build a custom runtime,
set the runtime field in .../app.yaml
to [runtime: custom]. To continue using the [python27] runtime, please
omit the Dockerfile from this directory.

これらのエラーを修正し、再度公開できましたが、次のようなエラーが表示されるようになりました。

Failed to import google/appengine/ext/deferred/handler.py
Traceback (most recent call last):
  File "/home/vmagent/python_vm_runtime/google/appengine/ext/vmruntime/meta_app.py", line 549, in GetUserAppAndServe
    app, mod_file = self.GetUserApp(script)
  File "/home/vmagent/python_vm_runtime/google/appengine/ext/vmruntime/meta_app.py", line 410, in GetUserApp
    app = _AppFrom27StyleScript(script)
  File "/home/vmagent/python_vm_runtime/google/appengine/ext/vmruntime/meta_app.py", line 270, in _AppFrom27StyleScript
    app, filename, err = wsgi.LoadObject(script)
  File "/home/vmagent/python_vm_runtime/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
ImportError: Import by filename is not supported.
4

1 に答える 1

5

少し掘り下げた後、何が起こっているのかを理解しました。つまり、これを処理するコードは次のとおりです。

builtins:
- remote_api: on
- appstats: on
- deferred: on

管理された VM で壊れています。正しい修正は、これらを排除し、代わりに組み込みインクルードをインライン化することです。これらのサブディレクトリ内に関連するインクルードを見つけることができます:

私の場合、これをhandlers:ディレクティブに追加することでした:

- url: /_ah/queue/deferred
  script: google.appengine.ext.deferred.application
  login: admin
- url: /_ah/stats.*
  script: google.appengine.ext.appstats.ui.app
- url: /_ah/remote_api(/.*)?
  script: google.appengine.ext.remote_api.handler.application

その理由については、ここで詳しく理解できます。google/appengine/ext/builtins/__init__.py#L92では、 runtime:app.yaml のフィールドを使用して、関連するインクルード ファイルを見つけようとします。つまり、以前は deferred/include-python27.yaml を検索していましたが、(上記のエラーを修正したため) deferred/include-custom.yaml を検索しようとして失敗しました。そのため、デフォルトで deferred/include.yaml になり、インクルード スクリプトがモジュール名ではなくパス名で一覧表示されます。これは python27-custom-VM セットアップで中断します (モジュール名が必要/必要であるため)

于 2015-11-28T06:39:32.847 に答える