在 Heroku 审核应用程序中指定 Postgres 数据库计划

Pet*_*ott 4 heroku heroku-postgres heroku-review-app

我正在尝试使用 Heroku 审核应用程序来测试并向我的同事展示我的网站。该站点有一个大型数据库,无法与 Heroku 的免费hobby-dev数据库一起使用。

我正在尝试按照指南使用app.json清单文件来指定我的应用程序的平台。我正在使用的代码如下:

应用程序.json

  {
    "name": "SiteName",
    "description": "The website for SiteName",
    "keywords": [
      "mezzanine",
      "django"
    ],
    "image": "heroku/python",
    "env": {
      "EMAIL_SYSTEM": {
        "description": "The email system to use, either console or mailgun",
        "value": "mailgun"
      },
      "ENVIRONMENT": {
        "description": "The dev environment, either production or test",
        "value": "production"
      },
      "ALLOWED_HOSTS": {
        "description": "Comma-separated list of hosts",
        "value": ".herokuapp.com"
      },
      "DEFAULT_FROM_EMAIL": "noreply@example.com",
      "SECRET_KEY": {
        "description": "A secret key for verifying the integrity of signed cookies.",
        "generator": "secret"
      },
      "WEB_CONCURRENCY": {
        "description": "The number of processes to run.",
        "value": "5"
      },
      "NODE_ENV": "production",
      "DEBUG": "False",
      "NPM_CONFIG_PRODUCTION": "false",
      "CELERY_REDIS_MAX_CONNECTIONS": 3,
      "S3_BUCKET": "my-s3-bucket",
      "USE_CELERY_TASKS": "True"
    },
    "formation": {
      "web": {
        "quantity": 1,
        "size": "Standard-1X"
      },
      "worker": {
        "quantity": 1,
        "size": "Standard-1X"
      }
    },
    "addons": [
      "heroku-redis",
      {
       "plan": "heroku-postgresql:standard-0",
        "as": "DATABASE"
      }
    ],
    "buildpacks": [
      {
        "url": "https://github.com/heroku/heroku-buildpack-python.git"
      }
    ],
    "scripts": {
      "postdeploy": "python manage.py migrate && python manage.py populate_db"
    },
    "environments": {
      "test": {
        "addons": [
          "heroku-postgresql:in-dyno",
          "heroku-redis:in-dyno"
        ],
        "env": {
          "APP_SKIP_DB_TEARDOWN": "True",
          "DB_REQUIRE_SSL": "False",
          "DEBUG": "True",
          "S3_BUCKET": "my-s3-bucket",
          "USE_CELERY_TASKS": "False"
        },
        "scripts": {
          "test-setup": "python manage.py collectstatic --noinput",
          "test": "python manage.py test"
        }
      }
    }
  }
Run Code Online (Sandbox Code Playgroud)

这将构建正常,但是我如何显式指定我希望使用的数据库计划?

Pet*_*ott 11

万一其他人遇到这种情况。

根据heroku支持,他们已经改变了为审查和CI应用程序提供插件的方式,这意味着默认情况下他们只会提供免费/最便宜的计划,无论你的app.json中有什么,这里有一些细节和他们的推理解释

如果您打开票证,他们可以在帐户级别覆盖此设置(在撰写本文时,这似乎并未内置到他们的管理区域中)