小编Sal*_*ikh的帖子

(gcloud.app.deploy) 错误响应:[7] 未配置访问权限。项目中尚未使用 Cloud Build

我在使用 python(3.5) 部署我的 django(2.1) 应用程序到 appengine 时遇到了这个错误。之前,我在 app.yaml 中使用 python 2 和 python27,没有这样的错误,但是现在当我的 app.yaml 中有 python 3.5.2 和 python37 时,我在“gcloud app deploy”之后遇到了这个错误。我真的必须启用计费功能还是我做错了什么?有出路吗?完整的错误是

错误:(gcloud.app.deploy) 错误响应:[7] 未配置访问权限。Cloud Build 之前未在项目 chaipani-217815 中使用过或已禁用。通过访问https://console.developers.google.com/apis/api/cloudbuild.googleapis.com/overview?project=chaipani-217815启用它,然后重试。如果您最近启用了此 API,请等待几分钟,让操作传播到我们的系统并重试。

django google-app-engine python-3.x app.yaml google-cloud-platform

9
推荐指数
4
解决办法
8093
查看次数

kex_exchange_identification:读取:操作超时

我是一个使用 Gitlab 进行版本控制的组织的开发人员。当我在推送提交时遇到错误时,一切都很顺利。

kex_exchange_identification: read: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)

我已经尝试了所有可以解决它的方法,例如生成一个全新的 ssh 密钥并将其添加到我的帐户中。我删除了存储库并尝试克隆,但再次遇到相同的错误。请帮忙。

git ssh-keys gitlab

8
推荐指数
1
解决办法
2万
查看次数

对依赖于数据库的函数进行单元测试

我正在对某些功能进行测试。我有一个使用数据库查询的函数。因此,我浏览了博客和文档,这些博客和文档说我们必须创建一个内存或测试数据库才能使用此类功能。以下是我的功能,

def already_exists(story_data,c):
    # TODO(salmanhaseeb): Implement de-dupe functionality by checking if it already
    # exists in the DB.
    c.execute("""SELECT COUNT(*) from posts where post_id = ?""", (story_data.post_id,))
    (number_of_rows,)=c.fetchone()
    if number_of_rows > 0:
        return True
    return False
Run Code Online (Sandbox Code Playgroud)

该函数访问生产数据库。我的问题是,在测试时,我创建一个内存数据库并在那里填充我的值,我将查询该数据库(测试数据库)。但我想测试我的already_exists()函数,从测试调用我的already_exists函数后,我的生产数据库将被命中。在测试此功能时如何使我的测试数据库命中?

python unit-testing database-testing python-unittest

0
推荐指数
1
解决办法
5798
查看次数