gpt4 book ai didi

ruby-on-rails - 本地 postrges 有效,但似乎无法推送到 RAILS_ENV=production heroku

转载 作者:行者123 更新时间:2023-11-29 14:09:54 26 4
gpt4 key购买 nike

我的应用程序在 localhost:3000 的本地环境中运行良好。它正在从我本地的 postgres 数据库中提取数据,但是我似乎没有更新生产环境。我的欢迎页面可以在我的 https://gcl.herokuapp.com 上查看页面,但是当我单击导航链接查看另一个页面时出现错误,我假设是因为该页面调用了数据库中的数据,但它找不到。

我正在做 $ rails db:migrate RAILS_ENV=production

我在终端中得到以下输出:

(0.2ms)  SELECT pg_try_advisory_lock(3666737882978712990);
ActiveRecord::SchemaMigration Load (0.6ms) SELECT "schema_migrations".*
FROM "schema_migrations"
ActiveRecord::InternalMetadata Load (0.6ms) SELECT
"ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2 [["key", :environment], ["LIMIT", 1]]
(0.2ms) BEGIN
SQL (1.9ms) UPDATE "ar_internal_metadata" SET "value" = $1, "updated_at" = $2 WHERE "ar_internal_metadata"."key" = $3 [["value", "production"], ["updated_at", 2017-03-31 10:42:57 UTC], ["key", "environment"]]
(0.4ms) COMMIT
(0.2ms) SELECT pg_advisory_unlock(3666737882978712990)

我的 Gemfile 中有 gem 'pg'

我的 database.yml 看起来像:

default: &default
adapter: postgresql
pool: 5
timeout: 5000

development:
adapter: postgresql
database: postgresql-rectangular-42683
pool: 5
timeout: 5000
test:
adapter: postgresql
database: postgresql-rectangular-42683
pool: 5
timeout: 5000

production:
adapter: postgresql
database: postgresql-rectangular-42683
username: Simon
password: *************

pool: 5
timeout: 5000`

有什么想法吗?现在已经尝试了大约一天的各种事情:(

西蒙

最佳答案

在终端试试这个:

heroku run rake db:create:all

然后运行迁移:

heroku run rake db:migrate

此外,您能否发布heroku logs的输出

关于ruby-on-rails - 本地 postrges 有效,但似乎无法推送到 RAILS_ENV=production heroku,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43139054/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com