将 Django 应用程序部署到 google 应用引擎

deploying django application to google app engine

我已经按照google云平台指南中的步骤进行操作,但仍然出现权限错误。这表示调用者没有权限。请问我做错了什么。 这是命令外gcloud config list

region = us-central1
zone = us-central1-f
[core]
account = <gmail-account>
disable_usage_reporting = True
project = <project-id>
Your active configuration is: [default]

这是它引发的错误

ERROR: (gcloud.app.deploy) Error Response: [13] Flex operation projects/<project-id>/regions/europe-west1/operations/error [INTERNAL]: An internal error occurred while processing task /appengine-flex-v1/insert_flex_deployment/flex_create_resources>2020-07-28T15:45:31.962Z49210.jv.11: Deployment Manager operation <project-id>/operation-... errors: [code: "RESOURCE_ERROR"
location: "/deployments/aef-default-..../resources/aef-default-...."
message: "{\"ResourceType\":\"compute.beta.regionAutoscaler\",
\"ResourceErrorCode\":\"403\",
\"ResourceErrorMessage\":{\"code\":403,
\"message\":\"The caller does not have permission\",
\"status\":\"PERMISSION_DENIED\",
\"statusMessage\":\"Forbidden\",
\"requestPath\":\"https://compute.googleapis.com/compute/beta/projects/<project-id>/regions/europe-west1/autoscalers\",
\"httpMethod\":\"POST\"}}"

请检查您的 project quotas 通常,当您的项目没有足够的 IP 或 VM(App Engine Flex 使用 Compute Engine VM)并且您的 app.yaml 上的扩展策略是超出配额。

请尝试在您的 app.yaml 文件中添加以下块之一

用于自动缩放

automatic_scaling:
    min_num_instances: 1
    max_num_instances: 2

对于手动缩放

manual_scaling:
   instances: 2

为避免用尽这些配额,delete/stop 您不需要的 App Engine 服务版本。

有关扩展策略的更多信息,请查看此 reference guide

例如: 每个虚拟机占用 1 个 IP,您的项目有 4 个配额。

如果您的应用引擎服务有 3 个虚拟机 运行(使用了 3 个 IP),在下一次部署中您只有 1 个 IP 可用,如果您的 min_instancesinstances app.yaml 文件大于 1,部署将失败。

这是因为不可能在您的项目上分配超过 4 个 IP,App 引擎会先打开新实例,然后关闭旧实例,这是为了避免服务中断

如果您需要增加此资源配额,则需要 contact a GCP sales rep