[英]Configure postgresql on database.yml
我在heroku上运行了Rails Web应用程序。 在我的heroku网站仪表板中,它说我的应用程序在postgresql上运行,但是我的database.yml说它在sqlite3上运行
default: &default
adapter: sqlite3
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: db/development.sqlite3
test:
<<: *default
database: db/test.sqlite3
production:
<<: *default
database: db/production.sqlite3
这是我的宝石文件
group :development do
gem 'sqlite3'
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :production do
gem 'pg'
end
我想使RAILS_MAX_THREADS
postgresql用于生产,因此我可以将RAILS_MAX_THREADS
更改为25。
我不确定是否更改此设置会删除我的生产数据库,所以我请您提供帮助以解决此问题。
您似乎尚未配置生产数据库。
production:
adapter: postgresql
database: your_database
user: your_user
password: your_password
pool: 5
您应该将数据库用户和密码保存在环境变量中。 您可能会发现此文档有用: https : //devcenter.heroku.com/articles/getting-started-with-rails5#add-the-pg-gem
在您的database.yml中,您必须配置生产环境
production:
adapter: postgresql
encoding: unicode
database: db_name
pool: 5
username: db_user
password: db_pass
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.