【发布时间】:2020-06-28 16:28:03
【问题描述】:
我正在尝试使用 Heroku 评论应用程序来测试我的网站并向我的同事展示。该站点有一个大型数据库,无法与 Heroku 的免费 hobby-dev 数据库一起使用。
我正在尝试使用app.json 清单文件来指定我的应用程序的平台,如the guide。我正在使用的代码如下:
app.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"
}
}
}
}
这样可以构建,但我如何明确指定我希望使用的数据库计划?
【问题讨论】:
-
试试不带
as键的{"plan": "heroku-postgresql:standard-0"}。 -
看起来是正确的。当您启动评论应用程序时,您会看到什么行为?错误的数据库层?错误?
-
@RangerRanger:我希望数据库属于 Standard-0 层,而不是我只得到一个 hobby-dev 层数据库。
-
您有信用卡吗?我想知道它是否出于付款原因默认免费。否则,可以尝试使用除
DATABASE之外的其他值作为附件。DATABASE配置变量周围有一些默认行为可能会导致问题。 -
@TinNguyen,试过了,结果一样,只是一个爱好级别的数据库
标签: heroku heroku-postgres heroku-review-app