我正在运行数据存储模拟器。当我运行“dev_应用服务器.py应用程序yaml“命令,我得到这个错误
403 Missing or insufficient permissions.
这是我得到的警告。我知道身份验证有问题。我已经通过了this。但最终无法找到解决办法。在
一些细节:
我正在使用MySQL数据库开发一些应用程序。
对于其他人,我想使用数据存储。
我在一个选项卡上运行数据存储模拟器,在另一个选项卡上运行Google云代理,在第三个选项卡上运行dev_appserver。
我已经使用gcloud beta模拟器datastore env init命令设置环境变量。
我的设置.py在
if os.getenv('GAE_APPLICATION', None):
# Running on production App Engine, so connect to Google Cloud SQL using
# the unix socket at /cloudsql/<your-cloudsql-connection string>
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': '/cloudsql/connectionname',
'NAME': 'db_name',
'USER': 'username',
'PASSWORD': 'password',
}
}
else:
# Running locally so connect to either a local MySQL instance or connect to
# Cloud SQL via the proxy. To start the proxy via command line:
#
# $ cloud_sql_proxy -instances=[INSTANCE_CONNECTION_NAME]=tcp:3306
#
# See https://cloud.google.com/sql/docs/mysql-connect-proxy
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'HOST': '127.0.0.1',
'PORT': '3307',
'NAME': 'dbname',
'USER': 'username',
'PASSWORD': 'password',
}
}
# [END db_setup]
我的应用程序yaml在
^{pr2}$技术背景:
Django 2.1款 Python 3.5.2版
堆栈跟踪:
Traceback (most recent call last):
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/django/core/handlers/base.py", line 124, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/salman/chaipani_env/project_chaipani/chaipani/views.py", line 20, in post_new
post = models.insert(data)
File "/home/salman/chaipani_env/project_chaipani/chaipani/models.py", line 15, in insert
client.put(entity)
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/google/cloud/datastore/client.py", line 404, in put
self.put_multi(entities=[entity])
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/google/cloud/datastore/client.py", line 431, in put_multi
current.commit()
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/google/cloud/datastore/batch.py", line 273, in commit
self._commit()
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/google/cloud/datastore/batch.py", line 249, in _commit
self.project, mode, self._mutations, transaction=self._id)
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/google/cloud/datastore_v1/gapic/datastore_client.py", line 426, in commit
request, retry=retry, timeout=timeout, metadata=metadata)
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/google/api_core/gapic_v1/method.py", line 139, in __call__
return wrapped_func(*args, **kwargs)
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/google/api_core/retry.py", line 260, in retry_wrapped_func
on_error=on_error,
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/google/api_core/retry.py", line 177, in retry_target
return target()
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/google/api_core/timeout.py", line 206, in func_with_timeout
return func(*args, **kwargs)
File "/tmp/tmpIZrOSY/lib/python3.5/site-packages/google/api_core/grpc_helpers.py", line 61, in error_remapped_callable
six.raise_from(exceptions.from_grpc_error(exc), exc)
File "<string>", line 3, in raise_from
google.api_core.exceptions.PermissionDenied: 403 Missing or insufficient permissions.
INFO 2018-10-10 10:51:26,298 module.py:880] default: "POST /users/post/new/ HTTP/1.1" 500 133823
您的默认服务帐户似乎没有足够的权限。它可能需要一些额外的权限,例如“Datastore Index Admin”来推断数据存储[1]。我不确定这将如何在数据存储模拟器中工作,但由于它的目标是提供本地仿真,可能它将获得执行测试的角色和权限。请检查您的服务帐户[2]中的权限,如果需要,请进行更改,如果问题仍然存在,请告诉我。我将等待你的答复。在
[1]https://cloud.google.com/appengine/docs/flexible/nodejs/granting-project-access#before_you_begin [2] https://cloud.google.com/iam/docs/granting-roles-to-service-accounts
相关问题 更多 >
编程相关推荐