2

我正在尝试在带有 Django 的 Cloud Run 上使用 Google Cloud Debugger。我红了这份文件。

https://cloud.google.com/debugger/docs/setup/python

我做了什么。

  1. 我在谷歌云中打开了调试器。
  2. 安装 google-python-cloud-debugger。
  3. 我创建了 source-context.json 与 models.py 相同的目录
  4. 我将此代码添加到 manage.py
try:
      import googleclouddebugger
      googleclouddebugger.enable()

    except ImportError:
      pass

我更新了 Google Cloud Run 的容器。我怎么在调试器中找不到任何应用程序

我从 GitHub 导入了我的源代码。我可以在调试器中看到我的代码。但是,我无法在 Debugger 页面中检查断点。

如何在 Clod Run 上调试 Django?请帮我。

更新

我做了这2步。

  1. 从IAM向服务帐户添加记录器Cloud Debugger Agent权限。

  2. 将 GitHub 存储库与 Google Cloud Source 连接起来

Cloud Debugger 适用于本地环境。但是,它在 Cloud Run 中不起作用。

这张图片只有本地应用。我找不到 Cloud Run 应用程序。 在此处输入图像描述

这是我的 yaml 文件。(我使用 Cloud Run 作为完全托管模式)

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: my_app
  namespace: '135253772466'
  selfLink: /apis/serving.knative.dev/v1/namespaces/135253772466/services/my_app
  uid: 61b4ac55-4aab-4d33-801d-d21b0d116ea4
  resourceVersion: AAWmjubgiTg
  generation: 176
  creationTimestamp: '2020-04-14T12:38:39.484473Z'
  labels:
    cloud.googleapis.com/location: asia-northeast1
  annotations:
    run.googleapis.com/client-name: gcloud
    serving.knative.dev/creator: 135253772466@cloudbuild.gserviceaccount.com
    serving.knative.dev/lastModifier: 135253772466@cloudbuild.gserviceaccount.com
    client.knative.dev/user-image: gcr.io/my_project/my_app
    run.googleapis.com/client-version: 291.0.0
spec:
  traffic:
  - percent: 100
    latestRevision: true
  template:
    metadata:
      name: my_app-00176-wud
      annotations:
        run.googleapis.com/client-name: gcloud
        client.knative.dev/user-image: gcr.io/my_project/my_app
        run.googleapis.com/client-version: 291.0.0
        autoscaling.knative.dev/maxScale: '1000'
    spec:
      timeoutSeconds: 900
      serviceAccountName: 135253772466-compute@developer.gserviceaccount.com
      containerConcurrency: 80
      containers:
      - image: gcr.io/my_project/my_app
        ports:
        - containerPort: 8080
        env:
        - name: CLOUD_RUN_HOST
          value: my_app-u3ljntrlma-an.a.run.app
        resources:
          limits:
            cpu: 1000m
            memory: 2048Mi
status:
  conditions:
  - type: Ready
    status: 'True'
    lastTransitionTime: '2020-05-26T15:39:32.595Z'
  - type: ConfigurationsReady
    status: 'True'
    lastTransitionTime: '2020-05-26T15:39:25.640Z'
  - type: RoutesReady
    status: 'True'
    lastTransitionTime: '2020-05-26T15:39:32.595Z'
  observedGeneration: 176
  traffic:
  - revisionName: my_app-00176-wud
    percent: 100
    latestRevision: true
  latestReadyRevisionName: my_app-00176-wud
  latestCreatedRevisionName: my_app-00176-wud
  address:
    url: https://my_app-u3ljntrlma-an.a.run.app
  url: https://my_app-u3ljntrlma-an.a.run.app


4

0 回答 0