我正在构建一个小型应用程序,它在本地运行。然后当我去 Heroku 上部署它时,我的终端中弹出了这个错误:
remote: An error occurred while installing sqlite3 (1.3.11), and
Bundler cannot
remote: continue.
remote: Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Detected sqlite3 gem which is not supported on Heroku.
remote: ! https://devcenter.heroku.com/articles/sqlite3
remote: !
remote:
remote: ! Push rejected, failed to compile Ruby app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to pockettheskimm.
remote:
To https://git.heroku.com/pockettheskimm.git
! [remote rejected] master -> master (pre-receive hook declined)
我随后 read the documentation on Heroku ,这告诉我必须在我的应用程序中使用 Postgres 而不是 sqlite3。所以我更新了我的应用程序,将 sqlite3 换成了 Postgres:
default: &default
adapter: postgresql
pool: 5
timeout: 5000
development:
<<: *default
database: db/development.postgresql
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: db/test.postgresql
production:
<<: *default
database: db/production.postgresql
但现在当我在本地运行应用程序时,我在浏览器中收到此错误:
ActiveRecord::NoDatabaseError
FATAL: database "db/development.postgresql" does not exist
Extracted source (around line #661):
659
660
661
662
663
664
rescue ::PG::Error => error
if error.message.include?("does not exist")
raise ActiveRecord::NoDatabaseError.new(error.message, error)
else
raise
end
我该怎么做才能解决这个问题?
最佳答案
这是对我有用的答案:
“在更改 database.yml 配置文件后,您是否在开发中运行了 rake db:create && rake db:migrate
?”
关于ruby-on-rails - ActiveRecord::NoDatabaseError fatal error :数据库 "db/development.postgresql"不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34203765/