我正在关注this tutorial在 Google AppEngine 上运行 Django 项目。我已完成创建 Cloud SQL 实例的步骤。我正在这一步:
Now use the Cloud SDK from command line to run the following command. Copy the value shown for connectionName for the next step.
gcloud sql instances describe [YOUR_INSTANCE_NAME]
The connectionName value is in the format [PROJECT_NAME]:[REGION_NAME]:[INSTANCE_NAME].
我收到以下错误:
$ gcloud sql instances describe django-polls-184415:us-west1:polls
ERROR: (gcloud.sql.instances.describe) Instance names cannot contain the ':' character. If you meant to indicate the
project for [polls], use only 'polls' for the argument, and either add
'--project django-polls-184415:us-west1' to the command line or first run
$ gcloud config set project django-polls-184415:us-west1
当我按照错误消息中的说明进行操作时,我得到了
$ gcloud config set project django-polls-184415:us-west1
Updated property [core/project].
$ gcloud sql instances describe polls
ERROR: (gcloud.sql.instances.describe) HTTPError 403: The client is not authorized to make this request.
$ gcloud sql instances describe --project django-polls-184415:us-west1 polls-instance
ERROR: (gcloud.sql.instances.describe) HTTPError 403: The client is not authorized to make this request.
我做错了什么?更重要的是我该如何正确地做到这一点?
附录
我已使用 gcloud auth application-default login
对 Cloud SDK 进行了身份验证。验证:
$ gcloud auth list
Credentialed Accounts
ACTIVE ACCOUNT
* <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b2d4ddddf2d0d3c09cd1dddf" rel="noreferrer noopener nofollow">[email protected]</a>
To set the active account, run:
$ gcloud config set account `ACCOUNT`
(真实账户正确。我已在此处进行了编辑。)
最佳答案
你必须create the instance首先,然后才能使用它。要检查您创建的实例列表,请使用:
gcloud sql instances list
然后显示实例的信息:
gcloud beta sql instances describe [YOUR_INSTANCE_NAME]
将 [YOUR_INSTANCE_NAME] 替换为 gcloud sqlInstances list
命令的“NAME”列的结果。
就您而言,403 错误意味着您没有“轮询”实例的权限。要么是因为您不拥有该实例,要么该实例尚未创建。
关于python - Google 应用引擎上的 Django : "Instance names cannot contain the ' :' character.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47006927/