gpt4 book ai didi

python - 标准 App Engine 项目错误地部署为灵活项目

转载 作者:太空宇宙 更新时间:2023-11-03 15:02:53 26 4
gpt4 key购买 nike

我已经在 App Engine 标准环境上运行了一些 Python 应用程序,最近一次成功部署是在 2017 年 4 月 7 日。今天尝试使用此命令部署更新时:

    gcloud.cmd app deploy --project <redacted-project-id> -v 5 --promote --quiet

我收到以下错误:

    Updated property [core/project].
Services to deploy:

descriptor: [D:\Projects\appengine\app.yaml]
source: [D:\Projects\appengine]
target project: [<redacted-project-id>]
target service: [default]
target version: [5]
target url: [https://<redacted-project-id>.appspot.com]


If this is your first deployment, this may take a while...failed.
WARNING: We couldn't validate that your project is ready to deploy to App Engine Flexible Environment. If deployment fails, please check the following message and try again:
Server responded with code [400]:
Bad Request Unexpected HTTP status 400.
Failed Project Preparation (app_id='s~<redacted-project-id>'). Out of retries. Last error: Temporary error occurred while verifying project: TEMPORARY_ERROR: Operation does not satisfy the following requirements: billing-enabled {Billing must be enabled for activation of service '' in project '<redacted-project-id>' to proceed., https://console.developers.google.com/project/<redacted-project-id>/settings}
com.google.api.management.server.common.exceptions.ServiceManagementNonRetriableStorageException: Operation does not satisfy the following requirements: billing-enabled {Billing must be enabled for activation of service '' in project '<redacted-project-id>' to proceed., https://console.developers.google.com/project/<redacted-project-id>/settings}
Beginning deployment of service [default]...
Building and pushing image for service [default]
Some files were skipped. Pass `--verbosity=info` to see which ones.
You may also view the gcloud log file, found at
[C:\Users\Brian\AppData\Roaming\gcloud\logs\2017.07.04\22.44.12.404000.log].
ERROR: (gcloud.app.deploy) You do not have permission to access project [<redacted-project-id>] (or it may not exist): The caller does not have permission

我为这个项目启用了计费功能,它尝试创建一个 docker,就像我想使用灵活的环境一样。

    Updated property [core/project].
Services to deploy:

descriptor: [D:\Projects\appengine\app.yaml]
source: [D:\Projects\appengine]
target project: [<redacted-project-id>]
target service: [default]
target version: [5]
target url: [https://<redacted-project-id>.appspot.com]


If this is your first deployment, this may take a while...done.

Beginning deployment of service [default]...
Building and pushing image for service [default]
Some files were skipped. Pass `--verbosity=info` to see which ones.
You may also view the gcloud log file, found at
[C:\Users\Brian\AppData\Roaming\gcloud\logs\2017.07.04\22.56.43.574000.log].
Started cloud build [818a94e7-584a-46a2-be15-bdb304b38fd3].
To see logs in the Cloud Console: https://console.cloud.google.com/gcr/builds/818a94e7-584a-46a2-be15-bdb304b38fd3?project=<redacted-project-id>
----------------------------- REMOTE BUILD OUTPUT ------------------------------
starting build "818a94e7-584a-46a2-be15-bdb304b38fd3"

FETCHSOURCE
Fetching storage object: gs://staging.<redacted-project-id>.appspot.com/us.gcr.io/<redacted-project-id>/appengine/default.5:latest#1499201946081566
Copying gs://staging.<redacted-project-id>.appspot.com/us.gcr.io/<redacted-project-id>/appengine/default.5:latest#1499201946081566...
| [1 files][ 79.1 MiB/ 79.1 MiB]
Operation completed over 1 objects/79.1 MiB.
BUILD
Already have image (with digest): gcr.io/cloud-builders/docker
Sending build context to Docker daemon 184.6MB
Step 1/2 : FROM gcr.io/google-appengine/php:latest
latest: Pulling from google-appengine/php
Digest: sha256:eeafc3e85abe6fb29b39fd87c73342527e2fdefc6ec173d55c60378e36b51fab
Status: Downloaded newer image for gcr.io/google-appengine/php:latest
# Executing 3 build triggers...
Step 1/1 : COPY . $APP_DIR
Step 1/1 : RUN chown -R www-data.www-data $APP_DIR


Command killed by keyboard interrupt

为什么要为 Python 项目创建 PHP docker 是一个谜。这是一个错误还是由于最近的 gcloud 组件更新而导致我的配置错误?

<小时/>

我的 app.yaml 文件按要求:

    runtime: python27
api_version: 1
threadsafe: yes

default_expiration: "7d 0h"

handlers:
- url: /robots.txt
static_files: static/robots.txt
upload: static/robots.txt

- url: /fonts/(.*\.otf)
static_files: static/fonts/\1
upload: static/fonts/(.*\.otf)
mime_type: application/x-font-otf

- url: /fonts/(.*\.ttf)
static_files: static/fonts/\1
upload: static/fonts/(.*\.ttf)
mime_type: application/x-font-ttf

- url: /fonts/(.*\.eot)
static_files: static/fonts/\1
upload: static/fonts/(.*\.eot)
mime_type: application/vnd.ms-fontobject

- url: /fonts/(.*\.svg)
static_files: static/fonts/\1
upload: static/fonts/(.*\.svg)
mime_type: image/svg+xml

- url: /fonts/(.*\.woff)
static_files: static/fonts/\1
upload: static/fonts/(.*\.woff)
mime_type: application/font-woff

- url: /fonts/(.*\.woff2)
static_files: static/fonts/\1
upload: static/fonts/(.*\.woff2)
mime_type: application/font-woff2

- url: /BingSiteAuth.xml
static_files: static/BingSiteAuth.xml
upload: static/BingSiteAuth.xml

- url: /favicon.ico
static_files: static/img/favicon.ico
upload: static/img/favicon.ico

- url: /(.*\.txt)
static_files: static/verification/\1
upload: static/verification/(.*\.txt)

- url: /static
static_dir: static

- url: /tasks/.*
script: main.app
login: admin

- url: /cron/.*
script: main.app
login: admin

- url: /.*
script: main.app

error_handlers:
- error_code: over_quota
file: static/over_quota.html


libraries:
- name: webapp2
version: latest
- name: jinja2
version: latest
- name: lxml
version: latest
- name: numpy
version: "1.6.1"
- name: pycrypto
version: latest
<小时/>

可能的解决方案:这似乎是使用 gcloud.cmd 部署导致的错误。我可以使用 appcfg.py 部署一个应用程序,如下所示:

    python.exe -u "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\appcfg.py" --oauth2_credential_file=C:\Users\Brian\.appcfg_oauth2 --application=<redacted-project-id> --version=5 update appengine

它在一个应用程序上运行,另一个应用程序失败并出现与上面类似的错误,“错误请求意外的 HTTP 状态 400”。

最佳答案

我找到了解决方案,它就在我这边。导致上述错误的原因是我的部署脚本在调用 gcloud app deploy 时提供了错误的代码库路径。它正在执行代码库上方的一个目录,这会导致上述错误。希望对其他人有帮助。

关于python - 标准 App Engine 项目错误地部署为灵活项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44914125/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com