我刚安装了heroku然后安装了postgresql,但现在我收到了这个错误。为什么我需要密码?我的密码是什么?
我花了几个小时寻找可行但却无法正常工作的东西(我在窗户上):
这是我的database.yml
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: postgresql
encoding: unicode
database: myapp_development
pool: 5
username: postgresql
password:
host: localhost
# 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:
adapter: postgresql
encoding: unicode
database: myapp_test
pool: 5
username: postgresql
password:
host: localhost
production:
adapter: postgresql
encoding: unicode
database: myapp_production
pool: 5
username: postgresql
password:
host: localhost
这是我的宝石文件
source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
gem 'devise'
gem 'pg'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :production do
gem 'rails_12factor'
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
知道我能做什么吗?
答案 0 :(得分:0)
根据this page,您可以使用此命令:
$ heroku config | grep HEROKU_POSTGRESQL
HEROKU_POSTGRESQL_RED_URL: postgres://user3123:passkja83kd8@ec2-117-21-174-214.compute-1.amazonaws.com:6212/db982398
给出的URL是postgresql connection字符串,其中包含嵌入的用户名和密码(本例中为user3123和passkja83kd8)。
答案 1 :(得分:0)
在test
文件的development
和database.yml
部分下的本地计算机上,您应该将username
更改为您登录的用户名。 rails生成器使它与您的appname相同,但不起作用。在生产中,部署到heroku时无关紧要,并且设置会自动更改。